SystemNotification

0.5.0

SystemNotification is a SwiftUI library that lets you mimic the native iOS system notification.
danielsaidi/SystemNotification

What's New

2022-01-21T12:00:14Z

This release greatly improves how notifications are presented and dismissed and simplifies usage.

The demo app now uses a local package, which makes it a lot easier to develop the library.

📖 Documentation

SystemNotification has a brand new DocC documentation.

Due to the new documentation, the package now requires Swift 5.5.

New features

  • SystemNotificationContext has a new completion-based dismiss function.
  • SystemNotificationMessageConfiguration has new iconTextSpacing and titleTextSpacing properties.
  • SystemNotificationUIKitOverlay is a new view that simplifies adding a system notification to a UIKit view.
  • View+SystemNotification has a new parameter-based extension that replaces the old notification-based one.

💡 Behavior changes

  • SystemNotificationMessageConfiguration is adjusted to make a message look more like an iPhone system notification.
  • Presenting a new notification first dismisses the current notification, if any.
  • The auto-dismiss logic is moved from the system notification to the notification context.

🐛 Bug fixes

  • This version fixes a bug, where the message configuration padding was incorrectly applied.

🗑 Deprecated

  • The notification-based systemNotification(:) function is deprecated.

💥 Breaking changes

  • SystemNotification+Message has been deprecated.
  • SystemNotificationConfiguration minWidth is no longer used and has been removed.
  • View+SystemNotification has deprecated the SystemNotification-based extension.

SystemNotification


Version Platform Swift 5.3 MIT License Twitter: @danielsaidi

About SystemNotification

SystemNotification is a SwiftUI library that lets you mimic the native iOS system notification, that for instance is presented when toggling silent mode on and off.

The result can look like this...or completely different:

These notifications have a default style, but can be customized to fit your specific app.

Installation

Swift Package Manager

https://github.com/danielsaidi/SystemNotification.git

CocoaPods

pod SystemNotification

Getting started

SystemNotification lets you present any SwiftUI view as iOS system notifications, which are the ones that appear from the top when you e.g. toggle Silent Mode or connect your AirPods.

System notifications are added just as you add a sheet, alert and fullScreenModal:

YourView()
    .systemNotification(...)

You can either add a view- or context-based system notification.

Read more here

Documentation

The SystemNotification documentation contains extensive information, code examples etc. and makes it easy to overview the various parts of the library.

You can either download the documentation or build it directly in Xcode, using Product/Build Documentation.

Demo app

This repo contains a basic demo app that demonstrates how to use the bottom sheet.

Just open the Demo project and run the app.

Contact me

Feel free to reach out if you have questions or if you want to contribute to this project in any way:

Sponsor my work

You can support my work by becoming a GitHub Sponsor.

License

SystemNotification is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue May 17 2022 08:31:39 GMT-0500 (GMT-05:00)