{"id":31718536,"url":"https://github.com/aws-amplify/amplify-swift-utils-notifications","last_synced_at":"2025-10-09T02:52:48.990Z","repository":{"id":98617326,"uuid":"563527981","full_name":"aws-amplify/amplify-swift-utils-notifications","owner":"aws-amplify","description":"This repository serves as a dependency package for amplify-swift, providing valuable functionalities to handle push notifications on iOS and macOS platforms.","archived":false,"fork":false,"pushed_at":"2025-09-17T19:39:40.000Z","size":608,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-09-20T07:07:02.277Z","etag":null,"topics":["aws","aws-amplify","ios","push-notification","swift"],"latest_commit_sha":null,"homepage":"https://aws-amplify.github.io/amplify-swift-utils-notifications/docs/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws-amplify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-08T19:56:08.000Z","updated_at":"2025-09-17T19:39:43.000Z","dependencies_parsed_at":"2023-12-14T21:26:28.122Z","dependency_job_id":"7d3f8a0e-d5c9-4fdf-abbf-a332746d84f9","html_url":"https://github.com/aws-amplify/amplify-swift-utils-notifications","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aws-amplify/amplify-swift-utils-notifications","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-amplify%2Famplify-swift-utils-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-amplify%2Famplify-swift-utils-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-amplify%2Famplify-swift-utils-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-amplify%2Famplify-swift-utils-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws-amplify","download_url":"https://codeload.github.com/aws-amplify/amplify-swift-utils-notifications/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-amplify%2Famplify-swift-utils-notifications/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000764,"owners_count":26082906,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aws","aws-amplify","ios","push-notification","swift"],"created_at":"2025-10-09T02:52:44.713Z","updated_at":"2025-10-09T02:52:48.976Z","avatar_url":"https://github.com/aws-amplify.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Amplify Swift Utilities for Notifications\n\n[![Code Coverage](https://codecov.io/gh/aws-amplify/amplify-swift-utils-notifications/branch/main/graph/badge.svg)](https://codecov.io/gh/aws-amplify/amplify-swift-utils-notifications)\n\nAmplify Swift Utilities for Notifications provides helpful functionality for working with push notifications on iOS and macOS.\n\nAlthough it was developed for use with AWS Amplify, it can also be used independently.\n\n\n[API Documentation](https://aws-amplify.github.io/amplify-swift-utils-notifications/docs/)\n\n\n## Features\n\n- Convenience methods to support requesting notification permissions and registering with APNs\n- Push Notification Service extension to support fetching and attaching remote media to notifications\n\n\n## Platform Support\nAmplify Swift Utilities for Notifications package supports iOS 13+ and macOS 10.15+.\n\n\n## License\n\nThis package is licensed under the Apache-2.0 License.\n\n\n## Installation\n\nThis package requires Xcode 13.4 or higher to build.\n\n\n### Swift Package Manager\n1. Swift Package Manager is distributed with Xcode. To start adding this package to your iOS project, open your project in Xcode and select **File \u003e Add Packages**.\n    ![add-packages](./readme-images/add-packages.png)\n\n2. Enter the package GitHub repo URL (https://github.com/aws-amplify/amplify-swift-utils-notifications) into the search bar.\n\n3. You'll see the repository rules for which version you want Swift Package Manager to install. Choose **Up to Next Major Version** and enter **1.0.0** as the minimum version for the Dependency Rule, then click **Add Package**.\n    ![amplify-swift-utils-notifications](./readme-images/amplify-swift-utils-notifications.png)\n\n4. Select `AmplifyUtilsNotifications`, then click Add Package.\n\n5. In your app code, explicitly import the plugin as needed.\n\n    ```swift\n    import SwiftUI\n    import AmplifyUtilsNotifications\n\n    @main\n    struct HelloWorldApp: App {\n        @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate\n        var body: some Scene {\n            WindowGroup {\n                ContentView()\n            }\n        }\n    }\n\n    class AppDelegate: NSObject, UIApplicationDelegate {\n        func applicationDidFinishLaunching(_ application: UIApplication) {\n            Task {\n                let isPushNotificationAllowed = await AmplifyUtilsNotifications.AUNotificationPermissions.allowed\n                // ...\n            }\n        }\n    }\n    ```\n\n### Cocoapods\n1. This package is also available through [CocoaPods](https://cocoapods.org/). If you have not installed CocoaPods, follow the instructions [here](https://guides.cocoapods.org/using/getting-started.html#getting-started).\n\n2. Add the package as a dependency to your Podfile.\n    ```ruby\n    platform :ios, '13.0'\n    use_frameworks!\n\n    target 'HelloWorldApp' do\n        pod 'AmplifyUtilsNotifications', '~\u003e 1.0.0'\n    end\n    ```\n\n3. Then run the following command:\n    ```sh\n    pod install\n    ```\n\n4. Open up *.xcworkspace with Xcode, and you will be able to use the `AmplifyUtilsNotifications` package in your project.\n\n## Notification Service Extension for AWS Pinpoint\n\nThis package includes a ready to use implementation(`AUNotificationService`) for handling remote notifications sent by AWS Pinpoint. It helps with decoding notification json data and retrieving the remote media url as an attachment.\n\n#### Push notification in AWS Pinpoint format\n1. Add a Service App Extension to Your Project. [Apple Doc](https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications).\n\n    ![add-notification-service-extension](./readme-images/add-notification-service-extension.png)\n\n2. Update `info.plist` of the newly created Notification Service Extension.\n\n    ```xml\n    \u003cdict\u003e\n        \u003ckey\u003eNSExtension\u003c/key\u003e\n        \u003cdict\u003e\n            \u003ckey\u003eNSExtensionPointIdentifier\u003c/key\u003e\n            \u003cstring\u003ecom.apple.usernotifications.service\u003c/string\u003e\n            \u003ckey\u003eNSExtensionPrincipalClass\u003c/key\u003e\n            \u003cstring\u003eAmplifyUtilsNotifications.AUNotificationService\u003c/string\u003e\n        \u003c/dict\u003e\n    \u003c/dict\u003e\n    ```\n\n    \u003e Note:\n    \u003e\n    \u003e We suggest you either keep the auto generated `NotificationService.swift` source file or add an empty swift file for your Notification Service Extension target. An empty source list will cause an error when you try to install the extension to a real device.\n\n### Push notification not in AWS Pinpoint format\n\nYou can also subclass `AUNotificationService` to support a different notification payload format or add custom functionality.\n\nFor example, we want to send the push notification with a field name `video_url`.\n\n1. Define a `MyPayload` struct that conforms to the `AUNotificationPayload` protocol. It defines the `remoteMediaURL`.\n\n2. Subclass `AUNotificationService` and change the `payloadSchema` property to `MyPayload` that was defined in the previous step.\n\n    ```swift\n    import AmplifyUtilsNotifications\n\n    struct MyPayload: AUNotificationPayload {\n        var remoteMediaURL: String? {\n            video_url\n        }\n\n        let video_url: String\n    }\n\n    class NotificationService: AUNotificationService {\n\n        override init() {\n            super.init()\n            self.payloadSchema = MyPayload.self\n        }\n    }\n    ```\n\n3. Update the `info.plist` by setting `NSExtensionPrincipalClass` to `$(PRODUCT_MODULE_NAME).NotificationService`.\n\nYou can also override the `didReceive` function to modify the content as desired. For example, attach suffix `[MODIFIED]` to your notification title.\n\n```swift\noverride func didReceive(\n    _ request: UNNotificationRequest,\n    withContentHandler contentHandler: @escaping (UNNotificationContent) -\u003e Void\n) {\n    super.didReceive(request) { content in\n        self.contentHandler = contentHandler\n        let mutableContent = content.mutableCopy() as? UNMutableNotificationContent\n        mutableContent?.title = content.title + \"[MODIFIED]\"\n        if let mutableContent {\n            contentHandler(mutableContent)\n        }\n    }\n}\n```\n\n\n\n\n## Reporting Bugs/Feature Requests\n\n[![Open Bugs](https://img.shields.io/github/issues/aws-amplify/amplify-swift-utils-notifications/bug?color=d73a4a\u0026label=bugs)](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues?q=is%3Aissue+is%3Aopen+label%3Abug)\n[![Open Questions](https://img.shields.io/github/issues/aws-amplify/amplify-swift-utils-notifications/usage%20question?color=558dfd\u0026label=questions)](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues?q=is%3Aissue+label%3A%22question%22+is%3Aopen+)\n[![Feature Requests](https://img.shields.io/github/issues/aws-amplify/amplify-swift-utils-notifications/feature%20request?color=ff9001\u0026label=feature%20requests)](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues?q=is%3Aissue+label%3A%22feature-request%22+is%3Aopen+)\n[![Closed Issues](https://img.shields.io/github/issues-closed/aws-amplify/amplify-swift-utils-notifications?color=%2325CC00)](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues?q=is%3Aissue+is%3Aclosed+)\n\nWe welcome you to use the GitHub issue tracker to report bugs or suggest features.\n\nWhen filing an issue, please check [existing open](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues), or [recently closed](https://github.com/aws-amplify/amplify-swift-utils-notifications/issues?utf8=%E2%9C%93\u0026q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already\nreported the issue. Please try to include as much information as you can. Details like these are incredibly useful:\n\n* Expected behavior and observed behavior\n* A reproducible test case or series of steps\n* The version of our code being used\n* Any modifications you've made relevant to the bug\n* Anything custom about your environment or deployment\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-amplify%2Famplify-swift-utils-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws-amplify%2Famplify-swift-utils-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-amplify%2Famplify-swift-utils-notifications/lists"}