From 2f83dc3d058f097dbe260744c335e9d7e7c62fad Mon Sep 17 00:00:00 2001 From: Daniel Thorpe Date: Sun, 30 Oct 2016 16:56:47 +0000 Subject: [PATCH] [VCD-26]: Updates for Xcode 8.1 --- .swift-version | 1 + Sources/ValueCoding.swift | 6 ++--- Supporting Files/ValueCoding.xcconfig | 1 + Supporting Files/Warnings.xcconfig | 27 +++++++++++++++++++ Tests/ValueCodingTests.swift | 4 +-- ValueCoding.xcodeproj/project.pbxproj | 17 +++++++++--- .../xcschemes/ValueCoding.xcscheme | 2 +- 7 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 .swift-version create mode 100644 Supporting Files/Warnings.xcconfig diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..bb576db --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +2.3 diff --git a/Sources/ValueCoding.swift b/Sources/ValueCoding.swift index 9dec72b..290b90f 100644 --- a/Sources/ValueCoding.swift +++ b/Sources/ValueCoding.swift @@ -76,7 +76,7 @@ public extension ValueCoding where Coder: NSCoding, Coder.Value == Self { be of `Coder` type. - returns: an optional `Self` */ - static func decode(_ object: AnyObject?) -> Self? { + static func decode(_ object: Any?) -> Self? { return (object as? Coder)?.value } @@ -89,7 +89,7 @@ public extension ValueCoding where Coder: NSCoding, Coder.Value == Self { - parameter objects: a `SequenceType` of `AnyObject`. - returns: the array of values which were able to be unarchived. */ - static func decode(_ objects: S?) -> [Self] where S.Iterator.Element: AnyObject { + static func decode(_ objects: S?) -> [Self] where S.Iterator.Element: Any { return objects?.flatMap(Self.decode) ?? [] } @@ -99,7 +99,7 @@ public extension ValueCoding where Coder: NSCoding, Coder.Value == Self { - parameter objects: a `SequenceType` of `SequenceType` of `AnyObject`. - returns: the array of arrays of values which were able to be unarchived. */ - static func decode(_ objects: S?) -> [[Self]] where S.Iterator.Element: Sequence, S.Iterator.Element.Iterator.Element: AnyObject { + static func decode(_ objects: S?) -> [[Self]] where S.Iterator.Element: Sequence, S.Iterator.Element.Iterator.Element: Any { return objects?.flatMap(Self.decode) ?? [] } diff --git a/Supporting Files/ValueCoding.xcconfig b/Supporting Files/ValueCoding.xcconfig index 6c60088..37abc2d 100644 --- a/Supporting Files/ValueCoding.xcconfig +++ b/Supporting Files/ValueCoding.xcconfig @@ -43,3 +43,4 @@ LD_RUNPATH_SEARCH_PATHS_framework = @executable_path/../Frameworks @loader_path/ LD_RUNPATH_SEARCH_PATHS_xctest = @loader_path/Frameworks @executable_path/Frameworks @loader_path/../Frameworks @executable_path/../Frameworks LD_RUNPATH_SEARCH_PATHS = $(LD_RUNPATH_SEARCH_PATHS_$(WRAPPER_EXTENSION)) +#include "Warnings.xcconfig" diff --git a/Supporting Files/Warnings.xcconfig b/Supporting Files/Warnings.xcconfig new file mode 100644 index 0000000..676b23d --- /dev/null +++ b/Supporting Files/Warnings.xcconfig @@ -0,0 +1,27 @@ +// +// ValueCoding +// +// Copyright © 2016 ProcedureKit. All rights reserved. +// + +CLANG_WARN_DOCUMENTATION_COMMENTS = YES +CLANG_WARN_BOOL_CONVERSION = YES +CLANG_WARN_CONSTANT_CONVERSION = YES +CLANG_WARN_EMPTY_BODY = YES +CLANG_WARN_ENUM_CONVERSION = YES +CLANG_WARN_INFINITE_RECURSION = YES +CLANG_WARN_INT_CONVERSION = YES +CLANG_WARN_SUSPICIOUS_MOVE = YES +CLANG_WARN_UNREACHABLE_CODE = YES +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +ENABLE_STRICT_OBJC_MSGSEND = YES +ENABLE_TESTABILITY = YES +GCC_NO_COMMON_BLOCKS = YES +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_VARIABLE = YES +CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR +CLANG_ANALYZER_NONNULL = YES diff --git a/Tests/ValueCodingTests.swift b/Tests/ValueCodingTests.swift index 4feb05e..c4b79c4 100644 --- a/Tests/ValueCodingTests.swift +++ b/Tests/ValueCodingTests.swift @@ -55,12 +55,12 @@ class ValueCodingTests: XCTestCase { } func test__multiple_archiving() { - let unarchived = Foo.decode(items.encoded) + let unarchived: [Foo] = Foo.decode(items.encoded) XCTAssertEqual(unarchived, items) } func test__nested_archiving() { - let unarchived = Foo.decode(nested.encoded) + let unarchived: [[Foo]] = Foo.decode(nested.encoded) XCTAssertEqual(unarchived.count, 1) XCTAssertEqual(unarchived[0], nested[0]) } diff --git a/ValueCoding.xcodeproj/project.pbxproj b/ValueCoding.xcodeproj/project.pbxproj index a26c910..a822611 100644 --- a/ValueCoding.xcodeproj/project.pbxproj +++ b/ValueCoding.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ /* Begin PBXFileReference section */ 658A7B5C1D776B7600F897C8 /* ValueCoding.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ValueCoding.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 658A7B651D776B7600F897C8 /* ValueCodingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ValueCodingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 65A3B8821DC659FE0042BB95 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 65CF6F511D776BBC004B3503 /* ValueCoding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueCoding.swift; sourceTree = ""; }; 65CF6F531D776BBC004B3503 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65CF6F541D776BBC004B3503 /* ValueCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueCoding.h; sourceTree = ""; }; @@ -60,8 +61,7 @@ children = ( 65CF6F501D776BBC004B3503 /* Sources */, 65CF6F5A1D77744D004B3503 /* Tests */, - 65CF6F521D776BBC004B3503 /* Supporting Files */, - 658A7B5D1D776B7600F897C8 /* Products */, + 65A3B8811DC659EA0042BB95 /* ... */, ); sourceTree = ""; }; @@ -74,6 +74,15 @@ name = Products; sourceTree = ""; }; + 65A3B8811DC659EA0042BB95 /* ... */ = { + isa = PBXGroup; + children = ( + 65CF6F521D776BBC004B3503 /* Supporting Files */, + 658A7B5D1D776B7600F897C8 /* Products */, + ); + name = ...; + sourceTree = ""; + }; 65CF6F501D776BBC004B3503 /* Sources */ = { isa = PBXGroup; children = ( @@ -89,6 +98,7 @@ 65CF6F531D776BBC004B3503 /* Info.plist */, 65CF6F591D77704D004B3503 /* ValueCoding.xcconfig */, 65CF6F581D776BD5004B3503 /* Version.xcconfig */, + 65A3B8821DC659FE0042BB95 /* Warnings.xcconfig */, ); path = "Supporting Files"; sourceTree = ""; @@ -159,7 +169,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0810; TargetAttributes = { 658A7B5B1D776B7600F897C8 = { CreatedOnToolsVersion = 8.0; @@ -241,6 +251,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 65CF6F591D77704D004B3503 /* ValueCoding.xcconfig */; buildSettings = { + ONLY_ACTIVE_ARCH = YES; }; name = Debug; }; diff --git a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding.xcscheme b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding.xcscheme index 8362628..089de83 100644 --- a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding.xcscheme +++ b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding.xcscheme @@ -1,6 +1,6 @@