Swiftpack.co - calimarkus/JDStatusBarNotification as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by calimarkus.
calimarkus/JDStatusBarNotification 2.2.2
Highly customizable & feature rich notifications. Interactive dismiss. Custom Views. SwiftUI. Tap-to-hold. Progress. Written in Swift, compatible for ObjC!
⭐️ 4,062
🕓 2 weeks ago
.package(url: "https://github.com/calimarkus/JDStatusBarNotification.git", from: "2.2.2")


Highly customizable & feature rich notifications displayed below the status bar / the notch.

  • Customizable colors, fonts & animations with multiple built-in styles
  • Interactive & interuptable Drag-to-Dismiss
  • Adaptive, dynamic layout
    • Built-in pill-style or full-width layouts
    • Pill width matches the presented text (customizable)
    • Works on notch and no-notch devices
    • Works in landscape & portrait
  • Built-in features (automatic layout):
    • Title, subtitle and left-hand-views (e.g. Icons)
    • An activity indicator
    • A progress bar
    • Custom views (UIView or SwiftUI View)

Written in Swift, compatible for Obj-C!

Please open a Github issue, if you think anything is missing or wrong.

Here's some examples of the possibilities (the pill style is the default):


Full-Width styles in action (the pill styles support the same features / animations):

Drag to dismiss Activity & Progress Bars Custom styles
1 3 2
Landscape apps (device rotation also supported)


  • SPM (Swift Package Manager):
    • Xcode -> File -> Add packages: [email protected]:calimarkus/JDStatusBarNotification.git
    • Importing:
      • In Swift: import JDStatusBarNotification
      • In ObjC: @import JDStatusBarNotification;
  • CocoaPods:
    • pod 'JDStatusBarNotification'
  • Carthage:
    • github "calimarkus/JDStatusBarNotification"
  • Manually:
    • Copy the JDStatusBarNotification/JDStatusBarNotification folder into your project.


Find the class documentation hosted on Github.



Getting started

NotificationPresenter is a singleton. You don't need to initialize it anywhere. All 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.

Here's some usage examples:

Showing a text notification

NotificationPresenter.shared.present("Hello World")

// with completion
NotificationPresenter.shared.present("Hello World") { presenter in
   // ...

Showing a SwiftUI based notification

NotificationPresenter.shared.presentSwiftView {
    Text("Hi from Swift!")

// with completion
NotificationPresenter.shared.presentSwiftView {
    Text("Hi from Swift!")
} completion: { presenter in
   // ...

Dismissing a notification


// with completion
NotificationPresenter.shared.dismiss(after: 0.5) { presenter in
   // ...

Showing activity



Showing a custom left view

let image = UIImageView(image: UIImage(systemName: "gamecontroller.fill"))
NotificationPresenter.shared.present("Player II", subtitle: "Connected")


Showing progress

NotificationPresenter.shared.present("Animating Progress…") { presenter in
  presenter.animateProgressBar(to: 1.0, duration: 0.75) { presenter in

// or set an explicit percentage manually (without animation)
NotificationPresenter.shared.displayProgressBar(at: 0.0)


Using other included styles

There's a few included styles you can easily use with the following API:

NotificationPresenter.shared.present("Yay, it works!",
                                     includedStyle: .success)


Using a custom UIView

If you want full control over the notification content and styling, you can use your own custom UIView.

// present a custom view
let button = UIButton(type: .system, primaryAction: UIAction { _ in
button.setTitle("Dismiss!", for: .normal)
Light Mode Dark Mode
customView customView2


You have the option to easily create & use fully customized styles.

The PrepareStyleClosure provides a copy of the default style, which can then be modified. See the StatusBarNotificationStyle API for all options.

// update default style
NotificationPresenter.shared.updateDefaultStyle { style in
   style.backgroundStyle.backgroundColor = .red
   style.textStyle.textColor = .white
   style.textStyle.font = UIFont.preferredFont(forTextStyle: .title3)
   // and many more options
   return style

// set a named custom style
NotificationPresenter.shared.addStyle(named: "xxx") { style in
   // ...
   return style

Style Editor

Or 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.


Background Styles

There's two supported background styles:

/// The background is a floating pill around the text. The pill size and appearance can be customized. This is the default.
/// The background covers the full display width and the full status bar + navbar height.

Animation Types

The supported animation types:

/// Slide in from the top of the screen and slide back out to the top. This is the default.
/// Fade-in and fade-out in place. No movement animation.
/// Fall down from the top and bounce a little bit, before coming to a rest. Slides back out to the top.


No notifications are showing up

If your app uses a UIWindowScene the NotificationPresenter needs to know about it before you present any notifications. The 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:



I'm @calimarkus on Twitter. Feel free to post a tweet, if you like JDStatusBarNotification.



Originally based on KGStatusBar by Kevin Gibbon


Stars: 4062
Last commit: 2 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

16 weeks ago

2.2.0 - 2023-12-10


  • New Swift-native APIs. These achieve more with less, as I can make proper use of e.g. optionals and default parameters.


  • Converted source code to Swift (with backwards compatible objc translation)
  • This lets me remove the hacks around multi-language targets

(Click the 2.2.0 version number for a full diff compared to 2.1.2.)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics