import SharedKit
SwiftyLaunch Version 1.1+ (Moved from NotifKit to SharedKit in 1.2)
In-App Notifications
In-App Notifications are an easy way to show a message to the user without interrupting their workflow. They are a great way to provide feedback, show errors, or give the user a heads up about something important.
You can show these notifications by calling
public func showInAppNotification(_ type: InAppNotificationType,
content: InAppNotificationContent,
size: InAppNotificationStyle.NotificationSize? = nil,
onTapAction: (() -> Void)? = nil)
type
- Predefined types of notifications. You can use.error
,.warning
,.info
,.info
, or.failure
.content
- The content of the notification, consist of the title and the message.size
- (Optional) The size of the notification..compact
or.normal
. (Defaults to.normal
)onTapAction
- (Optional) The action to be performed when the user taps on the notification.
In-App Notification Sizes
There are currently two different sizes for the in-app notifications.
Custom Styling
SwiftyLaunch includes 5 predefined styles for notifications, which you call by passing the type
parameter.
Example:
showInAppNotification(.success,
content: .init(title: "Success", message: "Account was created successfully!"),
size: .compact)
You can also show an In-App Notification with a custom style. Just pass the content
parameter together with style
instead of type
.
Example:
showInAppNotification(content: .init(title: "Custom Notification", message: "Custom Message"),
style: .init(sfSymbol: "star.fill", symbolColor: .indigo, size: .compact))
Integration
In-App Notifications are deeply integrated with other frameworks such as AuthKit or InAppPurchaseKit, which will display a notification after a successful or failed operation that requires user attention.