A .NET MAUI sample app that searches GitHub repositories and renders the results in a GitHub-dark-themed list. Built as a training project for exploring MAUI fundamentals: MVVM data binding, calling a REST API, JSON deserialization with System.Text.Json, and app-wide theming with XAML resource dictionaries.
- Search GitHub repositories by keyword via the GitHub Search API (no authentication; subject to the unauthenticated rate limit of 10 search requests/minute).
- Sort results by
stars,forks,help-wanted-issues, orupdated(top 10 results shown). - Tap a result to open the repository in the system browser.
- Search keyword and sort choice persist across app restarts (
Preferences). - Download progress bar while fetching; Snackbar with a Retry action on network failure.
- GitHub Dark UI throughout, using the Primer color palette (
#0d1117canvas,#161b22cards,#58a6ffaccent,#238636buttons). The app forces dark mode regardless of system theme.
MAUI_JSON_TEST/
├── MainPage.xaml(.cs) # Single page: search bar, sort picker, results list
├── ViewModel/
│ └── MainViewModel.cs # MVVM view model (INotifyPropertyChanged, ICommand)
├── Model/
│ ├── GitHubService/
│ │ └── Service.cs # HttpClient call to the GitHub Search API
│ └── Pojo/
│ ├── Respond.cs # Repository item DTO ([JsonPropertyName] mapping)
│ └── Owner.cs # Repository owner DTO
├── Resources/Styles/
│ ├── Colors.xaml # Color palette incl. GitHub Dark (Primer) colors
│ └── Styles.xaml # Implicit control styles (dark values use the palette)
└── Platforms/ # Android / iOS / Mac Catalyst / Windows bootstrap
There is no test project.
- .NET 8 (SDK
8.0.408pinned inglobal.json) - .NET MAUI, single-project targeting
net8.0-android,net8.0-ios,net8.0-maccatalyst, andnet8.0-windows10.0.19041.0(Windows target only when building on Windows) - CommunityToolkit.Maui — Snackbar
System.Text.Jsonfor deserialization
- .NET SDK 8.0.4xx
- MAUI workloads:
dotnet workload install maui - Platform tooling:
- Android — Android SDK plus an emulator or device
- iOS / Mac Catalyst — macOS with full Xcode installed (Command Line Tools alone are not enough; check
xcode-select -p) - Windows — Visual Studio 2022 with the .NET MAUI workload
dotnet restore
# Android
dotnet build MAUI_JSON_TEST/MAUI_JSON_TEST.csproj -f net8.0-android
dotnet build MAUI_JSON_TEST/MAUI_JSON_TEST.csproj -f net8.0-android -t:Run # deploy to a running emulator/device
# Mac Catalyst (requires Xcode)
dotnet build MAUI_JSON_TEST/MAUI_JSON_TEST.csproj -f net8.0-maccatalyst -t:Run
# Windows (on Windows)
dotnet build MAUI_JSON_TEST/MAUI_JSON_TEST.csproj -f net8.0-windows10.0.19041.0 -t:RunOr open MAUI_JSON_TEST.sln in Visual Studio / Rider, pick a target, and run.
- The Search button is disabled for queries containing spaces or non-ASCII characters, so multi-word and CJK searches are not possible.
- The search query is not URL-encoded before being appended to the request URL; characters like
&or#will break the query. - The progress bar only advances when the API response includes a
Content-Lengthheader; GitHub often streams chunked responses, in which case it stays at 0 until completion. - Results are fixed at 10 per search with no paging.
Missing workloaderrors →dotnet workload install maui- Apple targets fail with "Could not find a valid Xcode app bundle" → install full Xcode and run
sudo xcode-select -s /Applications/Xcode.app - No results plus a Retry Snackbar right after several searches → you likely hit the unauthenticated GitHub rate limit; wait a minute and retry