Skip to content

Commit

Permalink
Update Defaults+iCloud.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored Aug 5, 2024
1 parent caeb02b commit 4bc33d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/Defaults/Defaults+iCloud.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,15 @@ final class iCloudSynchronizer {
guard isInserted else {
return
}

localKeysMonitor.add(key: key)

// If the local value is the default value, only sync from remote, since all devices should already have the default value.
if key.isDefaultValue() {
guard case .remote = latestDataSource(forKey: key) else {
return
}

syncWithoutWaiting([key], .remote)
} else {
syncWithoutWaiting([key])
Expand Down

0 comments on commit 4bc33d8

Please sign in to comment.