{"id":29094238,"url":"https://github.com/wetransfer/uinotifications","last_synced_at":"2025-06-28T09:10:52.456Z","repository":{"id":41309056,"uuid":"97208861","full_name":"WeTransfer/UINotifications","owner":"WeTransfer","description":"Present custom in-app notifications easily in Swift","archived":false,"fork":false,"pushed_at":"2024-12-11T15:23:59.000Z","size":23052,"stargazers_count":399,"open_issues_count":0,"forks_count":27,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-26T05:46:48.215Z","etag":null,"topics":["wt-branch-protection-exempt","wt-branch-protection-two-approvals"],"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/WeTransfer.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":"2017-07-14T07:58:48.000Z","updated_at":"2025-04-17T13:28:57.000Z","dependencies_parsed_at":"2023-10-03T14:16:14.454Z","dependency_job_id":"62e79b45-8c9c-49de-9ce6-646014f03d97","html_url":"https://github.com/WeTransfer/UINotifications","commit_stats":{"total_commits":174,"total_committers":14,"mean_commits":"12.428571428571429","dds":0.6379310344827587,"last_synced_commit":"a895855e1d112723b7b9cffedbea77189c2a9bfe"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/WeTransfer/UINotifications","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FUINotifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FUINotifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FUINotifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FUINotifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeTransfer","download_url":"https://codeload.github.com/WeTransfer/UINotifications/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeTransfer%2FUINotifications/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262403828,"owners_count":23305692,"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":["wt-branch-protection-exempt","wt-branch-protection-two-approvals"],"created_at":"2025-06-28T09:10:51.666Z","updated_at":"2025-06-28T09:10:52.440Z","avatar_url":"https://github.com/WeTransfer.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"900px\" src=\"Assets/artwork.jpg\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://app.bitrise.io/app/aff79deadaca76df.svg?token=XtOuTac8yOiaRdCReWNdbA\"/\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/l/UINotifications.svg?style=flat\"/\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/p/UINotifications.svg?style=flat\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg?style=flat\"/\u003e\n\u003c/p\u003e\n\n- [Features](#features)\n- [Example](#example)\n- [Requirements](#requirements)\n- [Usage](#usage)\n    - [Making a Notification](#making-a-notification)\n    - [Create a custom style](#create-a-custom-style)\n    - [Use a custom dismiss trigger](#use-a-custom-dismiss-trigger)\n    - [Create a custom UINotificationView](#create-a-custom-uinotificationview)\n    - [Create a custom presenter](#create-a-custom-presenter)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Release Notes](#release-notes)\n- [License](#license)\n\n## Features\n- [x] Present your own custom view easily as an in-app Notification\n- [x] Create custom presentation styles\n- [x] Update content during presentation\n\n## Example\n\nTo run the example project, clone the repo, and open `UINotifications-Example.xcodeproj` from the Example directory.\n\n| Success styling        | Failure styling       |\n| ------------- |:-------------:|\n| ![Success](Assets/success_notification.jpg?) | ![Failure](Assets/fail_notification.jpg?) |\n\n## Usage\n\n### Making a Notification\n\n```swift\nimport UINotifications\n\nlet content = UINotificationContent(title: \"My Custom Text\", subtitle: \"My subtitle\", image: UIImage(named: \"MyImage\"))\nlet notification = UINotification(content: content, action: UINotificationCallbackAction(callback: {\n    print(\"Tapped the notification!\")\n}))\n\nlet dismissTrigger = UINotificationDurationDismissTrigger(duration: 2.0)\nUINotificationCenter.current.show(notification: notification, dismissTrigger: dismissTrigger)\n```\n\n### Create a custom style\n```swift\nimport UINotifications\n\nenum NotificationStyle: UINotificationStyle {\n    case success\n    case failure\n    \n    var titleFont: UIFont {\n        switch self {\n        case .success:\n            return .systemFont(ofSize: 15, weight: .semibold)\n        case .failure:\n            return .systemFont(ofSize: 13, weight: .regular)\n        }\n    }\n    \n    var subtitleFont: UIFont {\n        return .systemFont(ofSize: 13, weight: .regular)\n    }\n    \n    var titleTextColor: UIColor {\n        switch self {\n        case .success:\n            return .black\n        case .failure:\n            return .white\n        }\n    }\n    \n    var subtitleTextColor: UIColor {\n        return .darkGray\n    }\n    \n    var backgroundColor: UIColor {\n        switch self {\n        case .success:\n            return #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)\n        case .failure:\n            return #colorLiteral(red: 1, green: 0.431372549, blue: 0.431372549, alpha: 1)\n        }\n    }\n    \n    /// The height of the notification which applies on the notification view.\n    var height: UINotification.Height {\n        switch self {\n        case .success:\n            return .navigationBar\n        case .failure:\n            return .statusBar\n        }\n    }\n\n    /// Use this to set a max width to the notification view.\n    var maxWidth: CGFloat? {\n        return nil\n    }\n    \n    /// When `true`, the notification is swipeable and tappable.\n    var interactive: Bool {\n        return true\n    }\n    \n    var chevronImage: UIImage? {\n        return #imageLiteral(resourceName: \"iconToastChevron\")\n    }\n}\n```\n\nAnd use it:\n\n```swift\nlet notification = UINotification(content: myContent, style: CustomNotificationStyle.success)\n```\n\n### Use a custom dismiss trigger\n\n```swift\nlet manualDismissTrigger = UINotificationManualDismissTrigger()\nUINotificationCenter.current.show(notification: notification, dismissTrigger: manualDismissTrigger)\n\n/// Do other stuff..\n\nmanualDismissTrigger.trigger() // Dismiss\n```\n\n### Create a custom UINotificationView\n- Create a custom view and inherit from `UINotificationView`\n- Set your custom view on the `UINotificationCenter`:\n\n```swift\nUINotificationCenter.current.configuration = UINotificationCenterConfiguration(\n    defaultNotificationViewType: MyCustomNotificationView.self\n)\n```\n\n### Use a custom UIButton\nBy setting the `button` property on `UINotification`, you can simply add a button to the notification.\n\n```swift\nnotification.button = UIButton(type: .system)\n```\n\n![Button](Assets/button_notification.png?)\n\n### Create a custom presenter\nCreate a custom presenter to manage presentation and dismiss animations.\n\n- Create a custom class which inherits from `UINotificationPresenter`.\n- Set your custom presenter on the `UINotificationCenter`:\n\n```swift\nUINotificationCenter.current.configuration = UINotificationCenterConfiguration(\n    presenterType: MyCustomPresenter.self\n)\n```\n\n*Checkout `UINotificationEaseOutEaseInPresenter` for an example.*\n\n### Allow duplicate requests\nBy default, notifications which are already queued will not be queued again. This is to prevent an endless loop of notifications being presented if they occur quickly after each other.\n\nTo disable this setting:\n\n```swift\nUINotificationCenter.current.configuration = UINotificationCenterConfiguration(\n    isDuplicateQueueingAllowed: true\n)\n```\n\n## Communication\n\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n## Installation\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\n#### Manifest File\n\nAdd UINotifications as a package to your `Package.swift` file and then specify it as a dependency of the Target in which you wish to use it.\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyProject\",\n    platforms: [\n       .macOS(.v10_15)\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/WeTransfer/UINotifications.git\", .upToNextMajor(from: \"1.3.0\"))\n    ],\n    targets: [\n        .target(\n            name: \"MyProject\",\n            dependencies: [\"UINotifications\"]),\n        .testTarget(\n            name: \"MyProjectTests\",\n            dependencies: [\"MyProject\"]),\n    ]\n)\n```\n\n#### Xcode\n\nTo add UINotifications as a [dependency](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) to your Xcode project, select *File \u003e Swift Packages \u003e Add Package Dependency* and enter the repository URL.\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate UINotifications into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"WeTransfer/UINotifications\" ~\u003e 1.00\n```\n\nRun `carthage update` to build the framework and drag the built `UINotifications.framework` into your Xcode project.\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate UINotifications into your project manually.\n\n#### Embedded Framework\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command \"if\" your project is not initialized as a git repository:\n\n  ```bash\n  $ git init\n  ```\n\n- Add UINotifications as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command:\n\n  ```bash\n  $ git submodule add https://github.com/WeTransfer/UINotifications.git\n  ```\n\n- Open the new `UINotifications ` folder, and drag the `UINotifications.xcodeproj` into the Project Navigator of your application's Xcode project.\n\n    \u003e It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Select the `UINotifications.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- Select `UINotifications.framework`.\n- And that's it!\n\n  \u003e The `UINotifications.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n---\n\n## Release Notes\n\nSee [CHANGELOG.md](https://github.com/WeTransfer/UINotifications/blob/master/Changelog.md) for a list of changes.\n\n## License\n\nUINotifications is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwetransfer%2Fuinotifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwetransfer%2Fuinotifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwetransfer%2Fuinotifications/lists"}