Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix existential-any for Swift6 #180

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Defaults/Defaults+iCloud.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
Depending on the storage, `Defaults.Keys` will be represented in different forms due to storage limitations of the remote storage. The remote storage imposes a limitation of 1024 keys. Therefore, we combine the recorded timestamp and data into a single key. Unlike remote storage, local storage does not have this limitation. Therefore, we can create a separate key (with `defaultsSyncKey` suffix) for the timestamp record.
*/
final class iCloudSynchronizer {
init(remoteStorage: DefaultsKeyValueStore) {
init(remoteStorage: any DefaultsKeyValueStore) {
self.remoteStorage = remoteStorage
registerNotifications()
remoteStorage.synchronize()
Expand All @@ -231,7 +231,7 @@
/**
A remote key value storage.
*/
private let remoteStorage: DefaultsKeyValueStore
private let remoteStorage: any DefaultsKeyValueStore

/**
A FIFO queue used to serialize synchronization on keys.
Expand Down Expand Up @@ -539,7 +539,7 @@
if
let localTimestamp = self.timestamp(forKey: key, source: .local),
localTimestamp >= remoteTimestamp
{

Check warning on line 542 in Sources/Defaults/Defaults+iCloud.swift

View workflow job for this annotation

GitHub Actions / lint

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration (opening_brace)
continue
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Defaults/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ extension Defaults {

super.init(name: name, suite: suite)

if (defaultValue as? _DefaultsOptionalProtocol)?._defaults_isNil == true {
if (defaultValue as? (any _DefaultsOptionalProtocol))?._defaults_isNil == true {
return
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/Defaults/Observation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extension Defaults {
}

private static var preventPropagationThreadDictionaryKey: String {
"\(type(of: Observation.self))_threadUpdatingValuesFlag"
"\(type(of: (any Observation).self))_threadUpdatingValuesFlag"
}

/**
Expand Down Expand Up @@ -460,7 +460,7 @@ extension Defaults {
_ key: Key<Value>,
options: ObservationOptions = [.initial],
handler: @escaping (KeyChange<Value>) -> Void
) -> Observation {
) -> some Observation {
let observation = UserDefaultsKeyObservation(object: key.suite, key: key.name) { change in
handler(
KeyChange(change: change, defaultValue: key.defaultValue)
Expand Down Expand Up @@ -490,7 +490,7 @@ extension Defaults {
keys: _AnyKey...,
options: ObservationOptions = [.initial],
handler: @escaping () -> Void
) -> Observation {
) -> some Observation {
let pairs = keys.map {
(suite: $0.suite, key: $0.name)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Defaults/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension UserDefaults {
}

func _set<Value: Defaults.Serializable>(_ key: String, to value: Value) {
if (value as? _DefaultsOptionalProtocol)?._defaults_isNil == true {
if (value as? (any _DefaultsOptionalProtocol))?._defaults_isNil == true {
removeObject(forKey: key)
return
}
Expand Down
Loading