NoticeObserveKit
NoticeObserveKit is type-safe NotificationCenter wrapper.
Usage
First of all, you need to implement Notice.Name<T>
like this.
T
is type of value in notification.userInfo.
If you define custom object, you need to implement that with NoticeUserInfoDecodable
protocol. To confirm this protocol, you must implement init?(info: [AnyHashable : Any])
and func dictionaryRepresentation() -> [AnyHashable : Any]
.
Usage for under v0.4.0 is documents/v0_4_0.
Customization
If you can post custom Notification like this.
You can invalidate manually like this.
You can use vi NotificationCenter.
Sample
Requirements
- Swift 5
- Xcode 10.2 or greater
- iOS 10.0 or greater
- tvOS 10.0 or greater
- macOS 10.10 or greater
- watchOS 3.0 or greater
Installation
CocoaPods
NoticeObserveKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:
Carthage
If you’re using Carthage, simply add
NoticeObserveKit to your Cartfile
:
github "marty-suzuki/NoticeObserveKit"
Make sure to add NoticeObserveKit.framework
to "Linked Frameworks and Libraries" and "copy-frameworks" Build Phases.
Author
marty-suzuki, s1180183@gmail.com
License
NoticeObserveKit is available under the MIT license. See the LICENSE file for more info.