NoticeObserveKit
NoticeObserveKit copied to clipboard
Observe callback does not contain posted object, only contain userInfo.
version: 0.12
public func observe<Value: NoticeUserInfoDecodable>(name: Notice.Name<Value>,
object: Any? = nil,
queue: OperationQueue? = nil,
using: @escaping (Value) -> Void) -> Notice.Observer {
let observer = center.addObserver(forName: name.raw, object: object, queue: queue) { notification in
guard
let userInfo = notification.userInfo,
let value = Value(info: userInfo)
else {
return
}
using(value)
}
return Notice.Observer(center: center, raw: observer)
Here is the implementation in pods.
received object
is abandoned, can not get this from outside.