diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d973452 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: insidegui diff --git a/Package.swift b/Package.swift index c5a8e6a..678d0fc 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( .macOS(.v11), .iOS(.v14), .tvOS(.v14), - .watchOS(.v5) + .watchOS(.v7) ], products: [ .library(name: "CloudKitCodable", targets: ["CloudKitCodable"]) diff --git a/Sources/CloudKitCodable/CloudKitRecordDecoder.swift b/Sources/CloudKitCodable/CloudKitRecordDecoder.swift index 029384c..6ee3cd6 100644 --- a/Sources/CloudKitCodable/CloudKitRecordDecoder.swift +++ b/Sources/CloudKitCodable/CloudKitRecordDecoder.swift @@ -131,8 +131,6 @@ extension _CloudKitRecordDecoder.KeyedContainer: KeyedDecodingContainerProtocol func decode(_ type: T.Type, forKey key: Key) throws -> T where T : Decodable { try checkCanDecodeValue(forKey: key) - print("decode key: \(key.stringValue)") - if key.stringValue == _CKSystemFieldsKeyName { return systemFieldsData as! T } @@ -235,7 +233,9 @@ extension _CloudKitRecordDecoder.KeyedContainer: KeyedDecodingContainerProtocol let data = try Data(contentsOf: url) - return try T.decoded(from: data, type: contentType) + /// Don't use dynamic content type (which is the type when `URL` can't figure out its type). + let effectiveType = contentType.isDynamic ? T.preferredContentType : contentType + return try T.decoded(from: data, type: effectiveType) } private func decodeURL(from asset: CKAsset) throws -> URL {