Skip to content

sentryco/LocalNotification

Repository files navigation

Tests codebeat badge

⚙️ LocalNotification

  • LocalNotification is a Swift package that helps you manage local notifications in your iOS application.
  • Intended to be used as a debug tool for background operations where consol output doesnt work

Note

Can be used in production, but that isn't very usefull since most people will not allow app level notifications by default, to avoid notification spam etc

Features

  • Check and request local notification permisions
  • Direct call to show title and message
  • Constructor call to show title and message

Usage

Here's an example of how to use the LocalNotification package:

import LocalNotification

// Do this once at app first time start, can't be requested again
if !LocalNotification.isNotificationAvailable {
    LocalNotification.requestPermission()
}
// Check if available
guard LocalNotification.isNotificationAvailable else { print("Err, notification not allowed"); return }
// Direct call
LocalNotification.showNotification(title: "Feed the cat", body: "It looks hungry")
// Create a new notification
let notification = LocalNotification(title: "My Notification", body: "This is a notification")
notification.schedule()

// Cancel a notification
notification.cancel()

Installation

To install the LocalNotification package, add the following to your Package.swift file.

dependencies: [
    .package(url: "https://github.com/sentryco/LocalNotification.git", branch: "main")
]

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

⚙️ Debugging background operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages