NoticeObserveKit alternatives and similar libraries
Based on the "Events" category.
Alternatively, view NoticeObserveKit alternatives based on common mentions on social networks and blogs.
-
ReactiveCocoa
Cocoa framework and Obj-C dynamism bindings for ReactiveSwift. -
ReSwift
Unidirectional Data Flow in Swift - Inspired by Redux -
ReactorKit
A library for reactive and unidirectional Swift applications -
OpenCombine
Open source implementation of Apple's Combine framework for processing values over time. -
Katana
Swift Apps in a Swoosh! A modern framework for creating iOS apps, inspired by Redux. -
BrightFutures
Write great asynchronous code in Swift using futures and promises -
SwiftEventBus
A publish/subscribe EventBus optimized for iOS -
FutureKit
A Swift based Future/Promises Library for IOS and OS X. -
PMKVObserver
Modern thread-safe and type-safe key-value observing for Swift and Objective-C -
Tempura
A holistic approach to iOS development, inspired by Redux and MVVM -
VueFlux
:recycle: Unidirectional State Management Architecture for Swift - Inspired by Vuex and Flux -
When
:alarm_clock: A lightweight implementation of Promises in Swift -
SignalKit
SignalKit is a reactive Swift framework with focus on clean and readable API. -
RxReduce
Reactive implementation of the state container pattern (like Redux). It is based on the simple concepts of state immutability and unidirectionnal data flow. -
LightweightObservable
📬 A lightweight implementation of an observable sequence that you can subscribe to. -
Combinative
UI event handling using Apple's combine framework. -
Notificationz
📡 Helping you own NotificationCenter in Swift! -
Aftermath
:crystal_ball: Stateless message-driven micro-framework in Swift. -
TopicEventBus
Publish–subscribe design pattern implementation framework, with an ability to publish events by topic. -
OneWay
A Swift library for state management with unidirectional data flow. -
SSEventFlow
SSEventFlow is a type safe alternative to NotificationCenter, inspired by Flux -
Causality
A simple thread-safe, in-memory bus for Swift that supports fully-typed Events and States. -
Tokamak
Development fork of https://github.com/TokamakUI/Tokamak
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of NoticeObserveKit or a related project?
README
NoticeObserveKit
NoticeObserveKit is type-safe NotificationCenter wrapper.
// .keyboardWillShow is a static property.
Notice.Center.default.observe(name: .keyboardWillShow) { keyboardInfo in
// In this case, keyboardInfo is UIKeyboardInfo type.
// It is inferred from a generic parameter of Notice.Name<Value>.
print(keyboardInfo)
}
// pool is Notice.ObserverPool.
// If pool is released, Notice.Observes are automatically removed.
.invalidated(by: pool)
Usage
First of all, you need to implement Notice.Name<T>
like this.
T
is type of value in notification.userInfo.
extension Notice.Names {
static let keyboardWillShow = Notice.Name<UIKeyboardInfo>(UIResponder.keyboardWillShowNotification)
}
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]
.
struct UIKeyboardInfo: NoticeUserInfoDecodable {
let frame: CGRect
let animationDuration: TimeInterval
let animationCurve: UIViewAnimationOptions
init?(info: [AnyHashable : Any]) {
guard
let frame = (info[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let duration = info[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval,
let curve = info[UIKeyboardAnimationCurveUserInfoKey] as? UInt
else {
return nil
}
self.frame = frame
self.animationDuration = duration
self.animationCurve = UIViewAnimationOptions(rawValue: curve)
}
}
Usage for under v0.4.0 is [documents/v0_4_0](./documents/v0_4_0.md).
Customization
If you can post custom Notification like this.
extension Notice.Names {
static let navigationControllerDidShow = Notice.Name<NavigationControllerContent>(name: "navigationControllerDidShow")
}
let content = NavigationControllerContent(viewController: viewController, animated: animated)
Notice.Center.default.post(name: .navigationControllerDidShow, value: content)
You can invalidate manually like this.
let observer = Notice.Center.default.observe(name: .keyboardWillShow) { keyboardInfo in
print(keyboardInfo)
}
observer.invalidate()
You can use vi NotificationCenter.
NotificationCenter.default.nok.observe(name: .keyboardWillShow) { keyboardInfo in
print(keyboardInfo)
}
.invalidated(by: pool)
Sample
import UIKit
import NoticeObserveKit
class ViewController: UIViewController {
private let searchBar = UISearchBar(frame: .zero)
private var pool = Notice.ObserverPool()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
navigationItem.titleView = searchBar
configureObservers()
}
private func configureObservers() {
Notice.Center.default.observe(name: .keyboardWillShow) {
print("UIKeyboard will show = \($0)")
}.invalidated(by: pool)
Notice.Center.default.observe(name: .keyboardWillHide) {
print("UIKeyboard will hide = \($0)")
}.invalidated(by: pool)
}
}
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:
pod "NoticeObserveKit"
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, [email protected]
License
NoticeObserveKit is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the NoticeObserveKit README section above
are relevant to that project's source code only.