File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ public extension DefaultsAdapter {
36
36
syncer. syncedKeys. subtract ( rawKeys)
37
37
}
38
38
39
+ func forceSync( ) {
40
+ syncer. forceSync ( )
41
+ }
42
+
39
43
func stopSyncingAll( ) {
40
44
syncer. syncedKeys = [ ]
41
45
}
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ internal class DefaultsSyncer {
29
29
30
30
let defaults : UserDefaults
31
31
32
- var syncedKeys = Set < String > ( ) {
33
- didSet { iCloudDefaultsDidUpdate ( ) }
34
- }
32
+ var syncedKeys = Set < String > ( )
35
33
36
34
init ( defaults: UserDefaults ) {
37
35
self . defaults = defaults
@@ -43,6 +41,11 @@ internal class DefaultsSyncer {
43
41
name: UserDefaults . didChangeNotification)
44
42
}
45
43
44
+ internal func forceSync( ) {
45
+ iCloudDefaultsDidUpdate ( )
46
+ localDefaultsDidUpdate ( )
47
+ }
48
+
46
49
@objc
47
50
private func iCloudDefaultsDidUpdate( ) {
48
51
guard !syncedKeys. isEmpty else { return }
You can’t perform that action at this time.
0 commit comments