File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 25
25
#if !os(Linux)
26
26
27
27
public extension DefaultsAdapter {
28
- func syncKeys( _ keys: [ ( KeyStore ) -> RawKeyRepresentable ] ) {
29
- let keys = Set ( keys. map { $0 ( keyStore) . _key } )
30
- syncer. syncedKeys = keys
28
+
29
+ func startSyncing( for keyPaths: PartialKeyPath < KeyStore > ... ) {
30
+ let rawKeys = keyPaths. map { keyStore [ keyPath: $0] } . compactMap { $0 as? RawKeyRepresentable } . map { $0. _key }
31
+ rawKeys. forEach {
32
+ syncer. syncedKeys. insert ( $0)
33
+ }
34
+ }
35
+
36
+ func stopSyncing( for keyPaths: PartialKeyPath < KeyStore > ... ) {
37
+ let rawKeys = keyPaths. map { keyStore [ keyPath: $0] } . compactMap { $0 as? RawKeyRepresentable } . map { $0. _key }
38
+ rawKeys. forEach {
39
+ syncer. syncedKeys. remove ( $0)
40
+ }
31
41
}
42
+
43
+ func stopSyncingAll( ) {
44
+ syncer. syncedKeys = [ ]
45
+ }
46
+
32
47
}
33
48
34
49
#endif
Original file line number Diff line number Diff line change 24
24
25
25
import Foundation
26
26
27
- public protocol RawKeyRepresentable {
27
+ internal protocol RawKeyRepresentable {
28
28
var _key : String { get }
29
29
}
30
30
You can’t perform that action at this time.
0 commit comments