Give Your SwiftUI Apps That Native iOS Notification Feel
You know that little banner that slides down when you flip the silent switch on your iPhone, or when your AirPods connect? The one with the icon and text that feels unmistakably iOS? Trying to recreate that in SwiftUI usually means wrestling with custom animations, timing, and positioning—all for something that should be simple. That's exactly the problem SystemNotification solves. It's a lightweight SwiftUI library that lets you drop those native-looking system notifications into any view with a single view modifier, just like you would with sheet or alert.
What It Does
SystemNotification is a SwiftUI library designed to mimic the native iOS system notification presentation—the kind you see for silent mode toggles or accessory connections. It's built for Swift 6.1 and installable via the Swift Package Manager, so it slots right into your existing project structure.
The core architecture is straightforward. You apply a systemNotification view modifier to a view (ideally your root view), and then you have two ways to trigger notifications:
-
State-based notifications work with a boolean binding. When you flip that binding to
true, the notification appears. Think of it like asheetdriven by@State. -
Context-based notifications use a
SystemNotificationContextobject. This is the more flexible approach—you can present different notifications from anywhere in your view hierarchy using that single context instance.
The library also ships with a SystemNotificationMessage view that gives you the native look out of the box: an icon, a title, and supporting text. But you're not locked into that. The notification body is just a view builder, so you can pass in any custom SwiftUI view you want.
Why It's Cool
The real appeal here is how well it matches SwiftUI's existing mental model. You don't have to learn a whole new paradigm—if you've used alert or sheet, you already know how SystemNotification works.
-
It's declarative, not imperative. You're not manually managing frames, animations, or dismissal timers. You declare that a notification should appear and let the library handle the rest. That's a huge win for keeping your view code clean.
-
The two-mode system is genuinely thoughtful. The state-based approach is perfect for simple "toggle this on, show a notification" scenarios. But the context-based approach is where it gets powerful—you can trigger different notifications from different buttons, all routed through one modifier. That's a design choice that scales well as your app grows.
-
Native look without the native cost. Using
SystemNotificationMessagegives you that familiar iOS aesthetic with just a few lines of code. And when you need something custom, the view builder means you're not fighting the library—you're just dropping in your own content. -
It's a small, focused tool. This isn't a sprawling UI framework. It does one thing (system notifications) and does it well. That makes it easy to evaluate, adopt, and understand.
How to Try It
Getting started is quick. First, add the package to your project via Swift Package Manager:
https://github.com/danielsaidi/SystemNotification.git
Then, for a basic state-based notification, you'd write something like this:
import SystemNotification
struct MyView: View {
@State
var isActive = false
var body: some View {
VStack {
Button("Show notification") {
isActive = true
}
}
.systemNotification(isActive: $isActive) {
Text("You can use any custom content view")
.padding()
}
}
}
For the more flexible context-based approach:
@StateObject
var notification = SystemNotificationContext()
// In your view body
.systemNotification(notification)
// Trigger it from anywhere
notification.present {
SystemNotificationMessage(
icon: Text("👍"),
title: "Great job!",
text: "You presented a native-looking message!"
)
}
The repo has a Demo app you can explore to see the library in action, and the online documentation covers more advanced usage patterns. You can find everything on the GitHub repository.
Final Thoughts
SystemNotification is one of those libraries that feels obvious once you see it—the kind of tool that makes you wonder why you were doing it the hard way before. It's best suited for SwiftUI developers who want native-feeling feedback in their apps without reinventing the wheel. The API is clean, the documentation is solid, and the scope is refreshingly focused. If you've ever hacked together a custom notification view with mixed results, this is worth a look. It might just become one of those modifiers you reach for without thinking.
Follow @githubprojects for more developer tools and open source projects.