From d1e2109fc99a4471bc0193ae3f521fcf07695153 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 11 May 2022 15:21:55 +0700 Subject: [PATCH] Minor tweaks --- .../Defaults/Defaults+AnySerializable.swift | 40 +++++++++---------- Sources/Defaults/Utilities.swift | 2 +- readme.md | 2 + 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Sources/Defaults/Defaults+AnySerializable.swift b/Sources/Defaults/Defaults+AnySerializable.swift index 88a15b1..6a1bdf1 100644 --- a/Sources/Defaults/Defaults+AnySerializable.swift +++ b/Sources/Defaults/Defaults+AnySerializable.swift @@ -59,43 +59,43 @@ extension Defaults.AnySerializable: Hashable { public func hash(into hasher: inout Hasher) { switch value { case let value as Data: - return hasher.combine(value) + hasher.combine(value) case let value as Date: - return hasher.combine(value) + hasher.combine(value) case let value as Bool: - return hasher.combine(value) + hasher.combine(value) case let value as UInt8: - return hasher.combine(value) + hasher.combine(value) case let value as Int8: - return hasher.combine(value) + hasher.combine(value) case let value as UInt16: - return hasher.combine(value) + hasher.combine(value) case let value as Int16: - return hasher.combine(value) + hasher.combine(value) case let value as UInt32: - return hasher.combine(value) + hasher.combine(value) case let value as Int32: - return hasher.combine(value) + hasher.combine(value) case let value as UInt64: - return hasher.combine(value) + hasher.combine(value) case let value as Int64: - return hasher.combine(value) + hasher.combine(value) case let value as UInt: - return hasher.combine(value) + hasher.combine(value) case let value as Int: - return hasher.combine(value) + hasher.combine(value) case let value as Float: - return hasher.combine(value) + hasher.combine(value) case let value as Double: - return hasher.combine(value) - case let value as CGFloat: - return hasher.combine(value) + hasher.combine(value) + case let value as CGFloat: // swiftlint:disable:this no_cgfloat + hasher.combine(value) case let value as String: - return hasher.combine(value) + hasher.combine(value) case let value as [AnyHashable: AnyHashable]: - return hasher.combine(value) + hasher.combine(value) case let value as [AnyHashable]: - return hasher.combine(value) + hasher.combine(value) default: break } diff --git a/Sources/Defaults/Utilities.swift b/Sources/Defaults/Utilities.swift index 2a2356b..7921ea8 100644 --- a/Sources/Defaults/Utilities.swift +++ b/Sources/Defaults/Utilities.swift @@ -155,7 +155,7 @@ extension Sequence { Returns an array containing the non-nil elements. */ func compact() -> [T] where Element == T? { - // TODO: Make this `compactMap(\.self)` when https://bugs.swift.org/browse/SR-12897 is fixed. + // TODO: Make this `compactMap(\.self)` when https://github.com/apple/swift/issues/55343 is fixed. compactMap { $0 } } } diff --git a/readme.md b/readme.md index 103ffe1..5e95e1f 100644 --- a/readme.md +++ b/readme.md @@ -110,6 +110,8 @@ If a type conforms to both `NSSecureCoding` and `Codable`, then `Codable` will b You declare the defaults keys upfront with type and default value. +**Do not use a dot in the key name, because of [this bug](https://github.com/sindresorhus/Defaults/issues/59).** + ```swift import Cocoa import Defaults