{"id":2413,"url":"https://github.com/calimarkus/JDStatusBarNotification","last_synced_at":"2025-08-02T23:33:33.284Z","repository":{"id":11495010,"uuid":"13970367","full_name":"calimarkus/JDStatusBarNotification","owner":"calimarkus","description":"Highly customizable \u0026 feature rich notifications. Interactive dismiss. Custom Views. SwiftUI. Tap-to-hold. Progress. Written in Swift, compatible for ObjC!","archived":false,"fork":false,"pushed_at":"2024-07-18T16:06:08.000Z","size":2881,"stargazers_count":4232,"open_issues_count":6,"forks_count":562,"subscribers_count":110,"default_branch":"main","last_synced_at":"2024-12-03T00:08:56.689Z","etag":null,"topics":["activity","alert","banner","bubble","ios","notification","pill","progress","progress-bar","toast","toast-notifications","tooltip"],"latest_commit_sha":null,"homepage":"http://calimarkus.github.io/JDStatusBarNotification/documentation/jdstatusbarnotification","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/calimarkus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-10-29T22:14:59.000Z","updated_at":"2024-12-02T07:31:24.000Z","dependencies_parsed_at":"2022-07-14T07:00:39.728Z","dependency_job_id":"6cf370f3-deb5-4734-8dd1-d16ebddb6dcd","html_url":"https://github.com/calimarkus/JDStatusBarNotification","commit_stats":{"total_commits":531,"total_committers":26,"mean_commits":"20.423076923076923","dds":"0.24858757062146897","last_synced_commit":"00f4386a3dbfb56ddfc4703936b7b05076f9d42a"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calimarkus%2FJDStatusBarNotification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calimarkus%2FJDStatusBarNotification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calimarkus%2FJDStatusBarNotification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calimarkus%2FJDStatusBarNotification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calimarkus","download_url":"https://codeload.github.com/calimarkus/JDStatusBarNotification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228503208,"owners_count":17930538,"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":["activity","alert","banner","bubble","ios","notification","pill","progress","progress-bar","toast","toast-notifications","tooltip"],"created_at":"2024-01-05T20:16:13.158Z","updated_at":"2025-08-02T23:33:33.266Z","avatar_url":"https://github.com/calimarkus.png","language":"Swift","readme":"# JDStatusBarNotification\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fcalimarkus%2FJDStatusBarNotification%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/calimarkus/JDStatusBarNotification)\n\nHighly customizable \u0026 feature rich notifications displayed below the status bar / notch / Island. Written in Swift, compatible for Obj-C! Please open a [Github issue](https://github.com/calimarkus/JDStatusBarNotification/issues), if you think anything is missing or wrong.\n\n* Customizable colors, fonts \u0026 animations with multiple built-in styles\n* Interactive \u0026 interuptable Drag-to-Dismiss\n* Adaptive, dynamic layout\n    * Built-in pill-style or full-width layouts\n    * Pill width matches the presented text (customizable)\n    * Works on notch and no-notch devices\n    * Works in landscape \u0026 portrait\n* Built-in features (automatic layout):\n    * Title, subtitle and left-hand-views (e.g. Icons)\n    * An activity indicator\n    * A progress bar\n    * Custom views (UIView or SwiftUI View)\n\nSome examples of the possibilities - the pill style is the default:\n\n![examples](https://user-images.githubusercontent.com/807039/173831886-d7c8cca9-9274-429d-b924-78f21a4f6092.jpg)\n\nFull-Width styles in action - the above pill style supports the same features and animations:\n\n| Drag to dismiss | Activity \u0026 Progress Bars | Custom styles |\n| ------------- | ------------- | ------------- |\n| ![1](https://user-images.githubusercontent.com/807039/172001713-74d8c212-cd58-4687-8d6b-472e1bdb944d.gif) | ![3](https://user-images.githubusercontent.com/807039/172001734-be3c4e36-46b6-4f9f-a3d5-59a51e5db675.gif) | ![2](https://user-images.githubusercontent.com/807039/172001727-65aa6374-beeb-4a5c-adac-7e1967236b63.gif) |\n\n| Landscape apps (device rotation also supported) |\n| ------------- |\n| ![landscape](https://user-images.githubusercontent.com/807039/172003389-7752a183-f960-4bef-87c7-fcf583e4a13f.gif) |\n\n## Installation\n\n- [**SPM (Swift Package Manager):**](https://github.com/apple/swift-package-manager)\n  - Xcode -\u003e File -\u003e Add packages: `git@github.com:calimarkus/JDStatusBarNotification.git`\n  - Importing:\n      - In Swift: `import JDStatusBarNotification`\n      - In ObjC: `@import JDStatusBarNotification;`\n- [**CocoaPods:**](https://guides.cocoapods.org)\n  - `pod 'JDStatusBarNotification'`\n- [**Carthage:**](https://github.com/Carthage/Carthage)\n  - `github \"calimarkus/JDStatusBarNotification\"`\n- **Manually:**\n  - Copy the `JDStatusBarNotification/JDStatusBarNotification` folder into your project.\n\n## Documentation\n\nFind the [class documentation](http://calimarkus.github.io/JDStatusBarNotification/documentation/jdstatusbarnotification) hosted on Github.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md)\n\n## Getting started\n\nAll examples here are written in Swift. But everything can be called from Objective-C too. Also checkout the example project, which has many examples and includes a convenient style editor to build a custom style.\n\n### SwiftUI state-driven presentation\n\n#### Showing a simple text notification\n\n```swift\nvar body: some View {\n    Button(\"Present/dismiss\") {\n      isPresented.toggle()\n    }\n    .notification(title: \"Hello World\", isPresented: $isPresented)\n}\n```\n\n#### Showing a styled notification with subtitle, activity and/or progress\n\n```swift\nvar body: some View {\n    Button(\"Present/dismiss\") {\n      isPresented.toggle()\n    }\n    .notification(title: \"A text\",\n                  subtitle: \"with a little subtitle.\",\n                  isPresented: $isPresented,\n                  isShowingActivity: $activity, // toggles an activity indicator on/off\n                  progress: $progress,          // sets the percentage of a progress bar\n                  includedStyle: .success)      // picks a predefined style\n}\n```\n\n\n#### Showing a custom view as notification\n\n```swift\nvar body: some View {\n    Button(\"Present/dismiss\") {\n      isPresented.toggle()\n    }\n    .notification(isPresented: $isPresented) {\n      Text(\"👋 Hi there!\")\n        .font(.subheadline)\n        .foregroundStyle(.white)\n    }\n}\n```\n\n### Manual presentation (from Swift or ObjC)\n\n#### Showing a text notification\n\n```swift\nNotificationPresenter.shared.present(\"Hello World\")\n\n// with completion\nNotificationPresenter.shared.present(\"Hello World\") { presenter in\n    // ...\n}\n```\n\n#### Dismissing a notification\n\n```swift\nNotificationPresenter.shared.dismiss()\n\n// with completion\nNotificationPresenter.shared.dismiss(after: 0.5) { presenter in\n   // ...\n}\n```\n\n#### Showing activity\n\n```swift\nNotificationPresenter.shared.present(\"\")\nNotificationPresenter.shared.displayActivityIndicator(true)\n```\n\n![activity](https://user-images.githubusercontent.com/807039/175884729-c6255d41-4728-4bcb-bf72-fb12db01b5d5.gif)\n\n#### Showing a custom left view\n\n```swift\nlet image = UIImageView(image: UIImage(systemName: \"gamecontroller.fill\"))\nNotificationPresenter.shared.present(\"Player II\", subtitle: \"Connected\")\nNotificationPresenter.shared.displayLeftView(image)\n```\n\n![leftview](https://user-images.githubusercontent.com/807039/175884751-c93ffd31-a436-43d2-9eed-82d7cb23d8f6.gif)\n\n#### Showing progress\n\n```swift\nNotificationPresenter.shared.present(\"Animating Progress…\") { presenter in\n  presenter.animateProgressBar(to: 1.0, duration: 0.75) { presenter in\n    presenter.dismiss()\n  }\n}\n\n// or set an explicit percentage manually (without animation)\nNotificationPresenter.shared.displayProgressBar(at: 0.0)\n```\n\n![progress](https://user-images.githubusercontent.com/807039/175886588-e1aba466-85fa-4e32-951a-cd368c7d553d.gif)\n\n#### Using other included styles\n\nThere's a few included styles you can easily use with the following API:\n\n```swift\nNotificationPresenter.shared.present(\"Yay, it works!\",\n                                     includedStyle: .success)\n```\n\n![itworks](https://user-images.githubusercontent.com/807039/175888059-3beeb659-b561-4e7c-9c66-6fbc683ae152.jpg)\n\n#### Showing a custom SwiftUI view (Swift only)\n\n```swift\nNotificationPresenter.shared.presentSwiftView {\n    Text(\"Hi from Swift!\")\n}\n\n// with completion\nNotificationPresenter.shared.presentSwiftView {\n    Text(\"Hi from Swift!\")\n} completion: { presenter in\n   // ...\n}\n```\n\n#### Using a custom UIView (Swift or ObjC)\n\nIf you want full control over the notification content and styling, you can use your own custom UIView.\n\n```swift\n// present a custom view\nlet button = UIButton(type: .system, primaryAction: UIAction { _ in\n  NotificationPresenter.shared.dismiss()\n})\nbutton.setTitle(\"Dismiss!\", for: .normal)\nNotificationPresenter.shared.presentCustomView(button)\n```\n\n| Light Mode  | Dark Mode |\n| --- | --- |\n| ![customView](https://user-images.githubusercontent.com/807039/173234544-7a75edbe-00b1-437b-8651-2e63a1ba63c8.gif) | ![customView2](https://user-images.githubusercontent.com/807039/173234636-b3745101-0723-4342-9a3a-32a868ea820e.gif) |\n\n## Customization\n\nYou have the option to easily create \u0026 use fully customized styles.\n\n### From SwiftUI\n\nModify the style in a `NotificationStyleClosure`:\n\n```swift\nvar body: some View {\n    Button(\"Present/dismiss\") {\n      isPresented.toggle()\n    }\n    .notification(isPresented: $isPresented, style: {\n      let s = $0.backgroundStyle\n      s.backgroundColor = .black\n      s.pillStyle.minimumWidth = 150\n      s.pillStyle.height = 44\n    }) {\n      Text(\"👋 Hi there!\")\n        .font(.subheadline)\n        .foregroundStyle(.white)\n    }\n}\n```\n\n### Manually\n\nThe ``PrepareStyleClosure`` provides a copy of the default style, which can then be modified. See the ``StatusBarNotificationStyle`` API for all options.\n\n```swift\n// update default style\nNotificationPresenter.shared.updateDefaultStyle { style in\n   style.backgroundStyle.backgroundColor = .red\n   style.textStyle.textColor = .white\n   style.textStyle.font = UIFont.preferredFont(forTextStyle: .title3)\n   // and many more options\n   return style\n}\n\n// set a named custom style\nNotificationPresenter.shared.addStyle(named: \"xxx\") { style in\n   // ...\n   return style\n}\n```\n\n### Style Editor\n\nOr checkout the example project, which contains a full style editor. You can tweak all customization options within the app, see the changes live and even export the configuration code for the newly created style to easily use it in your app.\n\n![style-editor](https://user-images.githubusercontent.com/807039/174438815-4e3de17f-eb15-4281-b786-c1bfce7415da.jpg)\n\n### Background Styles\n\nThere's two supported `StatusBarNotificationBackgroundType`'s:\n\n```swift\nenum {\n    /// The background is a floating pill around the text.\n    /// The pill size and appearance can be customized. This is the default.\n    .pill,\n\n    /// The background covers the full display width and the full status bar + navbar height.\n    .fullWidth\n}\n```\n\n### Animation Types\n\nThe supported `StatusBarNotificationAnimationType`'s:\n\n```swift\nenum {\n    /// Slide in from the top of the screen and slide\n    /// back out to the top. This is the default.\n    .move,\n\n    /// Fade-in and fade-out in place. No movement animation.\n    .fade,\n\n    /// Fall down from the top and bounce a little bit, before\n    /// coming to a rest. Slides back out to the top.\n    .bounce\n}\n```\n\n## Troubleshooting\n\n### No notifications are showing up\n\nIf your app uses a `UIWindowScene` the `NotificationPresenter` needs to know about it before you present any notifications.\nThe library attempts to find the correct WindowScene automatically, but that might fail. If it fails no notifications will show up at all. You can explicitly set the window scene to resolve this:\n\n```swift\nNotificationPresenter.shared().setWindowScene(windowScene)\n```\n\n## Twitter\n\nI'm [@calimarkus](http://twitter.com/calimarkus) on Twitter. Feel free to [post a tweet](https://twitter.com/intent/tweet?button_hashtag=JDStatusBarNotification\u0026text=Simple%20and%20customizable%20statusbar%20notifications%20for%20iOS!%20Check%20it%20out.%20https://github.com/calimarkus/JDStatusBarNotification\u0026via=calimarkus), if you like JDStatusBarNotification.  \n\n[![tweetbutton](https://user-images.githubusercontent.com/807039/170856086-2c283e68-a44f-4a9f-b327-bd5a7c654455.png)](https://twitter.com/intent/tweet?button_hashtag=JDStatusBarNotification\u0026text=Simple%20and%20customizable%20statusbar%20notifications%20for%20iOS!%20Check%20it%20out.%20https://github.com/calimarkus/JDStatusBarNotification\u0026via=calimarkus)\n\n## Credits\n\nOriginally based on `KGStatusBar` by Kevin Gibbon\n","funding_links":[],"categories":["UI","Swift","Content"],"sub_categories":["Alert \u0026 Action Sheet","Alert","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalimarkus%2FJDStatusBarNotification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalimarkus%2FJDStatusBarNotification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalimarkus%2FJDStatusBarNotification/lists"}