Skip to content

Commit 74f03fa

Browse files
committed
Updates codebase to Swift 5
1 parent c33fbde commit 74f03fa

8 files changed

+26
-70
lines changed

NestedCloudKitCodable.xcodeproj/project.pbxproj

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
635FE21F21B05AAB00C2BC5F /* CKCodableError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635FE20221B05AAB00C2BC5F /* CKCodableError.swift */; };
4949
635FE22021B05AAB00C2BC5F /* CKCodableError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635FE20221B05AAB00C2BC5F /* CKCodableError.swift */; };
5050
635FE22121B05B4D00C2BC5F /* NestedCloudKitCodable.h in Headers */ = {isa = PBXBuildFile; fileRef = 635FE1E721B05A7400C2BC5F /* NestedCloudKitCodable.h */; settings = {ATTRIBUTES = (Public, ); }; };
51-
635FE22221B05B8500C2BC5F /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 635FE1E821B05A7400C2BC5F /* Info.plist */; };
52-
635FE22321B05B8500C2BC5F /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 635FE1E821B05A7400C2BC5F /* Info.plist */; };
5351
635FE22521B05CFC00C2BC5F /* NestedCloudKitCodable.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635FE1E521B05A7300C2BC5F /* NestedCloudKitCodable.framework */; };
5452
635FE22621B05CFC00C2BC5F /* NestedCloudKitCodable.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 635FE1E521B05A7300C2BC5F /* NestedCloudKitCodable.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5553
635FE22F21B05D6300C2BC5F /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 635FE22D21B05D6300C2BC5F /* Interface.storyboard */; };
@@ -481,7 +479,7 @@
481479
attributes = {
482480
DefaultBuildSystemTypeForWorkspace = Original;
483481
LastSwiftUpdateCheck = 1010;
484-
LastUpgradeCheck = 1010;
482+
LastUpgradeCheck = 1130;
485483
ORGANIZATIONNAME = "Guilherme Girotto";
486484
TargetAttributes = {
487485
631B89FF21A6E4FB0045FADC = {
@@ -506,6 +504,7 @@
506504
};
507505
635FE23621B05D6500C2BC5F = {
508506
CreatedOnToolsVersion = 10.1;
507+
LastSwiftMigration = 1130;
509508
};
510509
};
511510
};
@@ -546,15 +545,13 @@
546545
isa = PBXResourcesBuildPhase;
547546
buildActionMask = 2147483647;
548547
files = (
549-
635FE22321B05B8500C2BC5F /* Info.plist in Resources */,
550548
);
551549
runOnlyForDeploymentPostprocessing = 0;
552550
};
553551
635FE1E321B05A7300C2BC5F /* Resources */ = {
554552
isa = PBXResourcesBuildPhase;
555553
buildActionMask = 2147483647;
556554
files = (
557-
635FE22221B05B8500C2BC5F /* Info.plist in Resources */,
558555
);
559556
runOnlyForDeploymentPostprocessing = 0;
560557
};
@@ -713,7 +710,7 @@
713710
);
714711
PRODUCT_BUNDLE_IDENTIFIER = com.guilhermegirotto.NestedCKCodableExamples;
715712
PRODUCT_NAME = "$(TARGET_NAME)";
716-
SWIFT_VERSION = 4.2;
713+
SWIFT_VERSION = 5.0;
717714
TARGETED_DEVICE_FAMILY = "1,2";
718715
};
719716
name = Debug;
@@ -734,7 +731,7 @@
734731
);
735732
PRODUCT_BUNDLE_IDENTIFIER = com.guilhermegirotto.NestedCKCodableExamples;
736733
PRODUCT_NAME = "$(TARGET_NAME)";
737-
SWIFT_VERSION = 4.2;
734+
SWIFT_VERSION = 5.0;
738735
TARGETED_DEVICE_FAMILY = "1,2";
739736
};
740737
name = Release;
@@ -761,7 +758,7 @@
761758
PRODUCT_NAME = NestedCloudKitCodable;
762759
SDKROOT = watchos;
763760
SKIP_INSTALL = YES;
764-
SWIFT_VERSION = 4.2;
761+
SWIFT_VERSION = 5.0;
765762
TARGETED_DEVICE_FAMILY = 4;
766763
WATCHOS_DEPLOYMENT_TARGET = 4.0;
767764
};
@@ -789,7 +786,7 @@
789786
PRODUCT_NAME = NestedCloudKitCodable;
790787
SDKROOT = watchos;
791788
SKIP_INSTALL = YES;
792-
SWIFT_VERSION = 4.2;
789+
SWIFT_VERSION = 5.0;
793790
TARGETED_DEVICE_FAMILY = 4;
794791
WATCHOS_DEPLOYMENT_TARGET = 4.0;
795792
};
@@ -816,7 +813,7 @@
816813
PRODUCT_BUNDLE_IDENTIFIER = "com.guilhermegirotto.NestedCloudKitCodable-iOS";
817814
PRODUCT_NAME = NestedCloudKitCodable;
818815
SKIP_INSTALL = YES;
819-
SWIFT_VERSION = 4.2;
816+
SWIFT_VERSION = 5.0;
820817
TARGETED_DEVICE_FAMILY = "1,2";
821818
};
822819
name = Debug;
@@ -842,7 +839,7 @@
842839
PRODUCT_BUNDLE_IDENTIFIER = "com.guilhermegirotto.NestedCloudKitCodable-iOS";
843840
PRODUCT_NAME = NestedCloudKitCodable;
844841
SKIP_INSTALL = YES;
845-
SWIFT_VERSION = 4.2;
842+
SWIFT_VERSION = 5.0;
846843
TARGETED_DEVICE_FAMILY = "1,2";
847844
};
848845
name = Release;
@@ -863,7 +860,7 @@
863860
PRODUCT_NAME = "${TARGET_NAME}";
864861
SDKROOT = watchos;
865862
SKIP_INSTALL = YES;
866-
SWIFT_VERSION = 4.2;
863+
SWIFT_VERSION = 5.0;
867864
TARGETED_DEVICE_FAMILY = 4;
868865
WATCHOS_DEPLOYMENT_TARGET = 5.1;
869866
};
@@ -885,7 +882,7 @@
885882
PRODUCT_NAME = "${TARGET_NAME}";
886883
SDKROOT = watchos;
887884
SKIP_INSTALL = YES;
888-
SWIFT_VERSION = 4.2;
885+
SWIFT_VERSION = 5.0;
889886
TARGETED_DEVICE_FAMILY = 4;
890887
WATCHOS_DEPLOYMENT_TARGET = 5.1;
891888
};

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCKCodableExamples.xcscheme

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
6159
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
6260
</BuildableReference>
6361
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6662
</LaunchAction>
6763
<ProfileAction
6864
buildConfiguration = "Release"

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCKCodableWatch (Notification).xcscheme

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "2.0">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -41,8 +41,6 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44-
<Testables>
45-
</Testables>
4644
<MacroExpansion>
4745
<BuildableReference
4846
BuildableIdentifier = "primary"
@@ -52,8 +50,8 @@
5250
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
5351
</BuildableReference>
5452
</MacroExpansion>
55-
<AdditionalOptions>
56-
</AdditionalOptions>
53+
<Testables>
54+
</Testables>
5755
</TestAction>
5856
<LaunchAction
5957
buildConfiguration = "Debug"
@@ -79,17 +77,6 @@
7977
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
8078
</BuildableReference>
8179
</RemoteRunnable>
82-
<MacroExpansion>
83-
<BuildableReference
84-
BuildableIdentifier = "primary"
85-
BlueprintIdentifier = "635FE22A21B05D6300C2BC5F"
86-
BuildableName = "NestedCKCodableWatch.app"
87-
BlueprintName = "NestedCKCodableWatch"
88-
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
89-
</BuildableReference>
90-
</MacroExpansion>
91-
<AdditionalOptions>
92-
</AdditionalOptions>
9380
</LaunchAction>
9481
<ProfileAction
9582
buildConfiguration = "Release"

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCKCodableWatch.xcscheme

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -41,8 +41,6 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44-
<Testables>
45-
</Testables>
4644
<MacroExpansion>
4745
<BuildableReference
4846
BuildableIdentifier = "primary"
@@ -52,8 +50,8 @@
5250
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
5351
</BuildableReference>
5452
</MacroExpansion>
55-
<AdditionalOptions>
56-
</AdditionalOptions>
53+
<Testables>
54+
</Testables>
5755
</TestAction>
5856
<LaunchAction
5957
buildConfiguration = "Debug"
@@ -77,17 +75,6 @@
7775
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
7876
</BuildableReference>
7977
</RemoteRunnable>
80-
<MacroExpansion>
81-
<BuildableReference
82-
BuildableIdentifier = "primary"
83-
BlueprintIdentifier = "635FE22A21B05D6300C2BC5F"
84-
BuildableName = "NestedCKCodableWatch.app"
85-
BlueprintName = "NestedCKCodableWatch"
86-
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
87-
</BuildableReference>
88-
</MacroExpansion>
89-
<AdditionalOptions>
90-
</AdditionalOptions>
9178
</LaunchAction>
9279
<ProfileAction
9380
buildConfiguration = "Release"

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCloudKitCodable-iOS.xcscheme

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
5149
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCloudKitCodable-watchOS.xcscheme

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
5149
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"

NestedCloudKitCodable.xcodeproj/xcshareddata/xcschemes/NestedCloudKitCodable.xcscheme

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Release"
@@ -51,8 +49,6 @@
5149
ReferencedContainer = "container:NestedCloudKitCodable.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"

Sources/Decoder/CKDecoderKeyedContainer.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,17 @@ extension CKDecoderKeyedContainer {
7979
private func decodeCKRecordValue<T>(_ value: CKRecordValue, forKey key: Key) throws -> T where T: Decodable {
8080

8181
if let asset = value as? CKAsset {
82-
guard let data = try Data(contentsOf: asset.fileURL) as? T else {
82+
guard let assetURL = asset.fileURL, let data = try Data(contentsOf: assetURL) as? T else {
8383
throw CKCodableError(.typeMismatch, context: ["Error:": "Couldn't convert Data value to \(String(describing: T.self))"])
8484
}
8585
return data
8686
}
8787

8888
if let assets = value as? [CKAsset] {
8989
var datas = [Data]()
90-
try assets.forEach {
91-
let data = try Data(contentsOf: $0.fileURL)
90+
for asset in assets {
91+
guard let assetURL = asset.fileURL else { continue }
92+
let data = try Data(contentsOf: assetURL)
9293
datas.append(data)
9394
}
9495
guard let castedDatas = datas as? T else {

0 commit comments

Comments
 (0)