Hedwig shows notification and enables users to handle it.
Hedwig (d. 27 July, 1997) was Harry Potter's pet Snowy Owl. For more information, see Hedwig | Harry Potter Wiki.
Instead of just showing notification, Hedwig tries to be interactive. When a notification pops up, it will be more efficient and user-friendly if the user is able to handle it directly, especially for sophisticated applications like Facebook. Hedwig currently has a tap gesture recognizer so that you can handle the notification by adding an action to it. You can also customize it by adding views and gesture recognizers to satisfy your needs. Although it seems quite simple at the time, the concept behind is more important, and there are a lot Hedwig can develop in the future for better interaction.
- Create a Podfile, and add Hedwig:
target '<Your Project Name>' do
pod 'Hedwig', '~> 1.0'
end
- Run
$ pod installin your project directory. - Open
Project.xcworkspaceand build.
- Create a Cartfile, and add Hedwig:
github "Lab111/Hedwig" ~> 1.0
- Run
carthage updatein your project directory. - Drag
Hedwig.frameworkfromCarthage/Buildinto your Xcode project.
Hedwig works as a singleton, so you talk to shared directly to configure it. Some common configurations are listed below:
- Height:
Hedwig.shared.height - Background Color:
Hedwig.shared.windowShade.backgroundColor - Text Color:
Hedwig.shared.label.textColor - Font:
Hedwig.shared.label.font - Slide Duration:
Hedwig.shared.windowShade.slideDuration - Display Duration:
Hedwig.shared.displayDuration
import Hedwig
Hedwig.show(notification: "Hello from Hedwig")You can add action to the tapGestureRecognizer when asking Hedwig to show notification.
Hedwig.show(notification: "Hello from Hedwig", handler: { (_) in
print("Tap")
}, completion: nil)Hedwig.hide()Hedwig will hide automatically if the displayDuration is positive, but you can hide it manually before it hides automatically. Be aware that Hedwig will hide the notification when the user swipes up over it.
Hedwig is released under the MIT license. For details, see LICENSE.