TSMessages is an amazingly powerful in-app notifications library but requires a lot of setup. LNRSimpleNotifications is a simplified version for the developer who wants beautiful in-app notifications in minutes.
We're glad you asked.
If your project is in Swift:
If your project is in Objective-C:
To run the demo project clone the repo, and run pod install
from the Example directory first.
Configure your notification styles once in your app. The init method for whatever class is triggering your in-app notifications is a good choice.
The Class Triggering Notifications
import LNRSimpleNotifications
import AudioToolbox
###
let notificationManager = LNRNotificationManager()
func init() {
super.init()
notificationManager.notificationsPosition = LNRNotificationPosition.Top
notificationManager.notificationsBackgroundColor = UIColor.whiteColor()
notificationManager.notificationsTitleTextColor = UIColor.blackColor()
notificationManager.notificationsBodyTextColor = UIColor.darkGrayColor()
notificationManager.notificationsSeperatorColor = UIColor.grayColor()
var alertSoundURL: NSURL? = NSBundle.mainBundle().URLForResource("click", withExtension: "wav")
if let _ = alertSoundURL {
var mySound: SystemSoundID = 0
AudioServicesCreateSystemSoundID(alertSoundURL!, &mySound)
notificationManager.notificationSound = mySound
}
return true
}
You can also configure an icon that will appear in your notification and set a custom font for the notification title and body.
If you don't set any theme options your notifications will default to black text on a white background with no notification sound or icon.
The Class Triggering Notifications
let notificationManager = LNRNotificationManager()
###
func methodThatTriggersNotification:(title: String, body: String) {
notificationManager.showNotification(notification: LNRNotification(title: title, body: body, duration: LNRNotificationDuration.default.rawValue, onTap: { () -> Void in
print("Notification Dismissed")
}, onTimeout: { () -> Void in
print("Notification Timed Out")
}))
}
At the moment we know we've used it in:
We're doing more music festivals this year, so you'll see our simple yet stylish notifications in our apps a few more times this Summer and Fall.
Have you used LNRSimpleNotifications in a project? Want your app featured here? Let us know at [email protected].
Absolutely!
LISNR is a startup leveraging ultrasonic audio to transmit data between devices without a network. Using our technology we have synchronized light shows on phones at concerts, triggered location-based notifications, rewarded music fans with behind-the-scenes content, delivered at-shelf product information, and made art galleries come alive.
Want to know more about LISNR? Reach out to [email protected].
LNRSimpleNotifications is available under the MIT license. See LICENSE.txt for details.
LNRSimpleNotifications is based on TSMessages, developed by Felix Krause. If LNRSimpleNotifications isn't quite what you're looking for we recommend you check it out.
link |
Stars: 202 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics