{"id":18756234,"url":"https://github.com/simonberner/github-repowatcher-widget","last_synced_at":"2025-07-11T23:41:49.098Z","repository":{"id":64008796,"uuid":"571209731","full_name":"simonberner/github-repowatcher-widget","owner":"simonberner","description":"An iOS17+ GitHub Repo Watcher Widget 👀","archived":false,"fork":false,"pushed_at":"2023-12-24T14:15:31.000Z","size":2876,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T01:58:01.503Z","etag":null,"topics":["appintents","swiftui","widgetkit"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonberner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-11-27T14:18:08.000Z","updated_at":"2023-12-24T14:16:34.000Z","dependencies_parsed_at":"2023-11-30T17:36:27.764Z","dependency_job_id":"8b23e3aa-7567-471d-ae94-bedfa44553a7","html_url":"https://github.com/simonberner/github-repowatcher-widget","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonberner%2Fgithub-repowatcher-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonberner%2Fgithub-repowatcher-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonberner%2Fgithub-repowatcher-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonberner%2Fgithub-repowatcher-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonberner","download_url":"https://codeload.github.com/simonberner/github-repowatcher-widget/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654048,"owners_count":21140235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appintents","swiftui","widgetkit"],"created_at":"2024-11-07T17:35:44.346Z","updated_at":"2025-04-13T01:58:31.576Z","avatar_url":"https://github.com/simonberner.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=center\u003eGitHub Repo Watcher Widget\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://en.wikipedia.org/wiki/IOS\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/iOS-17.0+-blue.svg?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.swift.org/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Swift-5.9-brightgreen.svg?style=for-the-badge\u0026logo=swift\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/xcode/swiftui\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/SwiftUI-blue.svg?style=for-the-badge\u0026logo=swift\u0026logoColor=black\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/xcode\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Xcode-15.1-blue.svg?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://mastodon.green/@simonberner\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contact-@simonberner-orange?style=for-the-badge\" alt=\"mastodon.green/@simonberner\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://gitmoji.dev\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=for-the-badge\" alt=\"Gitmoji\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/conventional-commits/conventionalcommits.org\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Conventional%20Commits-📝-lightgrey.svg?style=for-the-badge\" alt=\"Conventional Commits\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-MIT-black.svg?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nThis is a more advanced iOS17+ widget project to learn how to create a medium and large widget which relies on network calls to update its content.\n\n---\n\n## Contents\n* [Functionality](#functionality)\n* [Tech Stack](#tech-stack)\n* [Frameworks](#frameworks)\n* [Device Compatibility](#device-compatibility)\n* [Screenshots](#screenshots)\n* [Learnings](#learnings)\n* [GitHub API Call](#gitHub-api-call)\n* [Testing](#testing)\n* [Code Comments](#code-comments)\n* [Pull Requests](#pull-requests)\n* [Credits](#credits)\n\n---\n\n## Functionality\nA medium and large sized Widget that gets a GitHub repository and displays the following infos:\n- Owner avatar image\n- Repository name\n- Days since last pushes\n- Number of watchers\n- Number of forks\n- Number of open issues\n\nA large sized Widget that gets the (top 4) contributors of a GitHub repository and displays the following infos:\n- Login name\n- Avatar\n- Number of contributions made\n\nAn App Group is setup among the GitHubRepoWatcher and the RepoWatcherIntents target to share the same UserDefaults database.\n\n## Tech Stack\n- Xcode 15.1\n- Swift 5.9\n\n## Frameworks\n- SwiftUI\n- [WidgetKit](https://developer.apple.com/documentation/widgetkit)\n- [App Intents](https://developer.apple.com/documentation/appintents/)\n\n## Device Compatibility\n- iPhone \u003e= iOS17.0+\n- iPad \u003e= iOS17.0+\n\n## Screenshots\n| Medium/Large Widget | Large Widget |\n| :---: | :---: |\n| \u003cimg src=\"AppScreenshots/compact-widgets.webp\" height=\"98%\" width=\"98%\" \u003e | \u003cimg src=\"AppScreenshots/contributor-widget.webp\" height=\"100%\" width=\"100%\" \u003e |\n\n| Edit Widget | Widget Intent Configurations |\n| :---: | :---: |\n| \u003cimg src=\"AppScreenshots/double-repo-widget-edit.webp\" height=\"100%\" width=\"100%\" \u003e | \u003cimg src=\"AppScreenshots/double-repo-widget-configuration.webp\" height=\"90%\" width=\"90%\" \u003e |\n\n| Lock Screen Widgets | Lock Screen Conf |\n| :---: | :---: |\n| \u003cimg src=\"AppScreenshots/lock-screen-widgets.webp\" height=\"100%\" width=\"100%\" \u003e | \u003cimg src=\"AppScreenshots/lock-screen-widgets-rect-circ.webp\" height=\"100%\" width=\"100%\" \u003e |\n\n| Lock Screen Conf | App Main View |\n| :---: | :---: |\n| \u003cimg src=\"AppScreenshots/lock-screen-widget-inline.webp\" height=\"98%\" width=\"98%\" \u003e | \u003cimg src=\"AppScreenshots/app.webp\" height=\"100%\" width=\"100%\" \u003e |\n\n## Learnings\n- AsyncImage is not working for widgets.\n- To chose good useful information to show to a user of a widget is fundamental. A good widget has to show to a user:\n    - Glanceable UI Elements\n    - Graphical attractive data\n    - Quick information\n### Widget Gallery\nPoint of contention:\n- Apple recommends giving a Widget some placeholder (mock data) to show it in the Widget Gallery instead of doing any network calls.\n(Note: Twitch does network calls in getSnapshot, but probably because of some business reasons)\n- But we want to show our users the best representation of our widgets, so how do we do that? Better mock-data?\n### Alerts\n- Normally there are no error alerts shown to a user in a widget.\n    - But there are cases where it makes sense to tell the user an issue (eg. 'Sign in with Google').\n    - How you handle errors in Widgets is a unique product decision.\n    - To make our lives as developer easier, add log/print statements for debugging errors.\n### Network calls\n- A successive network call is a network call that relies on a parent network call\n### JSON\n- [Codable: A type alias for Encodable and Decodable](https://www.swiftbysundell.com/basics/codable/)\n- [Ignoring invalid JSON elements when using Codable](https://www.swiftbysundell.com/articles/ignoring-invalid-json-elements-codable/)\n### Structured Concurrency\n- Async/await: 'try await' is like a guard statement, if it fails nothing is being executed below it (because it falls into the catch block)\n### Widget Bundle\n- If we have an App with different widget types, we can put them into a [WidgetBundle](https://developer.apple.com/documentation/swiftui/widgetbundle)\n### Widget Configurations\n- Configurations introduces _(SiriKit) Intents Definitions File_\n- 1. Setup an intents definition file\n- 1.1 Info: The intent definition file creates lots of code for you (e.g protocols, classes)\n- 2. Setup an IntentHandler which is handled in an intents extension target\n- 3. Add the App Group as capability to the intents extension target\n### Lock Screen Widget\n- Is just another small view\n- Lock screen widget families are: .accessoryInline, .accessoryRectangular, .accessoryCircular\n- On the lock screen: each widget of the same widget type (here GitHubRepo Watcher), can have its own configuration\n    \n## GitHub API Call\n- [Get a repository](https://docs.github.com/en/rest/repos/repos#get-a-repository)\n\n## Testing\nI use the [Arrange, Act and Assert Pattern](https://automationpanda.com/2020/07/07/arrange-act-assert-a-pattern-for-writing-good-tests/) for Unit Testing.\n\n## Code Comments\nI love putting in the effort of adding comments to my code, [here is why](https://www.youtube.com/watch?v=1NEa-OcsTow).\n\n## Pull Requests\nWhen I create PRs I stick to [this guideline](https://www.youtube.com/watch?v=_sfzAOfY8uc).\n\n## Credits\n🙏🏽 Sean Allen\n\n\u003chr\u003e\n\u003cp align=\"center\"\u003e\nMade with a 🙂 \u003ca href=\"https://simonberner.dev\"\u003eSimon Berner\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonberner%2Fgithub-repowatcher-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonberner%2Fgithub-repowatcher-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonberner%2Fgithub-repowatcher-widget/lists"}