Skip to content

Commit

Permalink
fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hank121314 committed Dec 29, 2023
1 parent f38a785 commit 0ece716
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Sources/Defaults/Defaults+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ extension UserDefaults: Defaults.KeyValueStore {}

extension _DefaultsLockProtocol {
@discardableResult
func with<R>(_ body: @Sendable () throws -> R) rethrows -> R where R : Sendable {
func with<R>(_ body: @Sendable () throws -> R) rethrows -> R where R: Sendable {
self.lock()
defer {
self.unlock()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Defaults/Defaults+Protocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ protocol _DefaultsLockProtocol {

func unlock()

func with<R>(_ body: @Sendable () throws -> R) rethrows -> R where R : Sendable
func with<R>(_ body: @Sendable () throws -> R) rethrows -> R where R: Sendable
}
22 changes: 11 additions & 11 deletions Sources/Defaults/Defaults+iCloud.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum DataSource {
private enum SyncStatus {
case idle
case syncing
case completed
case completed
}

extension Defaults {
Expand Down Expand Up @@ -154,7 +154,7 @@ extension Defaults {
- Parameter source: Sync key from which data source(remote or local).
*/
private func syncKey(_ key: Defaults.Keys, _ source: DataSource) async {
Self.logKeySyncStatus(key, source: source, syncStatus: .idle)
Self.logKeySyncStatus(key, source: source, syncStatus: .idle)
switch source {
case .remote:
await syncFromRemote(key: key)
Expand Down Expand Up @@ -330,9 +330,9 @@ extension Defaults.iCloudSynchronizer {
var status: String
var valueDescription = " "
switch syncStatus {
case .idle:
status = "Try synchronizing"
case .syncing:
case .idle:
status = "Try synchronizing"
case .syncing:
status = "Synchronizing"
valueDescription = " with value \(value ?? "nil") "
case .completed:
Expand Down Expand Up @@ -411,28 +411,28 @@ extension Defaults {
Add the keys to be automatically synced.
*/
public static func add(_ keys: Defaults.Keys...) {
synchronizer.add(keys)
synchronizer.add(keys)
}

/**
Remove the keys that are set to be automatically synced.
*/
public static func remove(_ keys: Defaults.Keys...) {
synchronizer.remove(keys)
synchronizer.remove(keys)
}

/**
Remove all keys that are set to be automatically synced.
*/
public static func removeAll() {
synchronizer.removeAll()
synchronizer.removeAll()
}

/**
Explicitly synchronizes in-memory keys and values with those stored on disk.
*/
public static func synchronize() {
synchronizer.synchronize()
synchronizer.synchronize()
}

/**
Expand All @@ -446,7 +446,7 @@ extension Defaults {
Create synchronization tasks for all the keys that have been added to the `Defaults.iCloud`.
*/
public static func syncWithoutWaiting() {
synchronizer.syncWithoutWaiting()
synchronizer.syncWithoutWaiting()
}

/**
Expand All @@ -458,7 +458,7 @@ extension Defaults {
- Note: `source` should be specify if `key` has not been added to `Defaults.iCloud`.
*/
public static func syncWithoutWaiting(_ keys: Defaults.Keys..., source: DataSource? = nil) {
synchronizer.syncWithoutWaiting(keys, source)
synchronizer.syncWithoutWaiting(keys, source)
}
}
}
2 changes: 1 addition & 1 deletion Sources/Defaults/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extension Defaults {
self.defaultValueGetter = { defaultValue }

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

if iCloud {
Defaults.iCloud.add(self)
}
Expand Down

0 comments on commit 0ece716

Please sign in to comment.