File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 11import Foundation
22
3+ /// A protocol used for adding and removing key observations
34public protocol KeyObservationRegistry {
45 associatedtype S : StorageAware
56
7+ /**
8+ Registers observation closure which will be removed automatically
9+ when the weekly captured observer has been deallocated.
10+ - Parameter observer: Any object that helps to determine if the observation is still valid
11+ - Parameter key: Unique key to identify the object in the cache
12+ - Parameter closure: Observation closure
13+ - Returns: Token used to cancel the observation and remove the observation closure
14+ */
615 @discardableResult
716 func addObserver< O: AnyObject > (
817 _ observer: O ,
918 forKey key: String ,
1019 closure: @escaping ( O , S , KeyChange < S . T > ) -> Void
1120 ) -> ObservationToken
1221
22+ /// Removes observer by the given key.
1323 func removeObserver( forKey key: String )
24+
25+ /// Removes all registered key observers
1426 func removeAllKeyObservers( )
1527}
1628
Original file line number Diff line number Diff line change 11import Foundation
22
3+ /// A protocol used for adding and removing storage observations
34public protocol StorageObservationRegistry {
45 associatedtype S : StorageAware
56
7+ /**
8+ Registers observation closure which will be removed automatically
9+ when the weekly captured observer has been deallocated.
10+ - Parameter observer: Any object that helps to determine if the observation is still valid
11+ - Parameter closure: Observation closure
12+ - Returns: Token used to cancel the observation and remove the observation closure
13+ */
614 @discardableResult
715 func addStorageObserver< O: AnyObject > (
816 _ observer: O ,
917 closure: @escaping ( O , S , StorageChange ) -> Void
1018 ) -> ObservationToken
1119
20+ /// Removes all registered key observers
1221 func removeAllStorageObservers( )
1322}
1423
You can’t perform that action at this time.
0 commit comments