From fa8a1d94abe2fa37643d3bf66ba2bee3ee890e42 Mon Sep 17 00:00:00 2001 From: Ruotger Deecke Date: Fri, 24 May 2019 17:42:02 +0200 Subject: [PATCH] migrate to Swift 5 and fix all kinds of warnings --- Extensions/Array+FURRExtensions.swift | 10 ++-- Extensions/Info.plist | 2 +- FURRExtensions.xcodeproj/project.pbxproj | 46 ++++++++----------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++ .../xcschemes/Extensions.xcscheme | 2 +- 5 files changed, 35 insertions(+), 33 deletions(-) create mode 100644 FURRExtensions.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Extensions/Array+FURRExtensions.swift b/Extensions/Array+FURRExtensions.swift index f6b635c..24b2f5a 100644 --- a/Extensions/Array+FURRExtensions.swift +++ b/Extensions/Array+FURRExtensions.swift @@ -28,7 +28,7 @@ import Foundation public extension Array { - public func reversed() -> [Element] { + func reversed() -> [Element] { var result: [Element] = Array() var mutSelf: [Element] = self while mutSelf.count != 0 { @@ -40,7 +40,7 @@ public extension Array { return result } - public func optionalElement(index: Int?) -> Element? { + func optionalElement(index: Int?) -> Element? { guard let index = index else { return nil } if index < 0 { @@ -58,7 +58,7 @@ public extension Array { return optionalElement(index: index) } - public func divideUntil(_ divisionBlock: (_: Element) -> Bool) -> ([Element], [Element]) { + func divideUntil(_ divisionBlock: (_: Element) -> Bool) -> ([Element], [Element]) { var beforeArray: [Element] = Array() var afterArray: [Element] = Array() @@ -84,7 +84,7 @@ public extension Array where Element: Equatable { /// WARNING: this method takes time in the order of O(n^2) for the worst case (no dupes) /// - returns: true if at least two objects are equal (==) - public func containsDuplicates() -> Bool { + func containsDuplicates() -> Bool { if self.count < 2 { return false } @@ -117,7 +117,7 @@ public extension Array where Element: Hashable { /// This method is potentially faster than containsDuplicates() especially with bigger data sets but /// will also need more memory. Also elements need to conform to Hashable. /// - returns: true if at least two objects are equal (==) - public func containsDuplicatesFast() -> Bool { + func containsDuplicatesFast() -> Bool { if self.count < 2 { return false } diff --git a/Extensions/Info.plist b/Extensions/Info.plist index 33d5c6d..288c341 100644 --- a/Extensions/Info.plist +++ b/Extensions/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.2.2 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/FURRExtensions.xcodeproj/project.pbxproj b/FURRExtensions.xcodeproj/project.pbxproj index 5c5748e..09f9796 100644 --- a/FURRExtensions.xcodeproj/project.pbxproj +++ b/FURRExtensions.xcodeproj/project.pbxproj @@ -250,16 +250,17 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Ruotger Deecke"; TargetAttributes = { 5698BA8D1B8DD347008805E2 = { CreatedOnToolsVersion = 7.0; - LastSwiftMigration = 0930; + LastSwiftMigration = 1020; + ProvisioningStyle = Automatic; }; 5698BA971B8DD347008805E2 = { CreatedOnToolsVersion = 7.0; - LastSwiftMigration = 0930; + LastSwiftMigration = 1020; }; DDAE95F21BFB0CDF00E5F7FA = { CreatedOnToolsVersion = 7.1.1; @@ -271,10 +272,11 @@ }; buildConfigurationList = 5698BA881B8DD347008805E2 /* Build configuration list for PBXProject "FURRExtensions" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 5698BA841B8DD347008805E2; productRefGroup = 5698BA8F1B8DD347008805E2 /* Products */; @@ -416,11 +418,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_ASSIGN_ENUM = YES; @@ -449,7 +450,6 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -467,15 +467,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -485,11 +481,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_ASSIGN_ENUM = YES; @@ -518,7 +513,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; @@ -530,16 +524,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0.1; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; - VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -550,8 +540,11 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -561,10 +554,10 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.RuotgerSkupin.FURRExtensions; PRODUCT_NAME = FURRExtensions; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -573,8 +566,11 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -584,11 +580,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.RuotgerSkupin.FURRExtensions; PRODUCT_NAME = FURRExtensions; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -603,8 +599,7 @@ PRODUCT_NAME = FURRExtensions; SWIFT_OBJC_BRIDGING_HEADER = "ExtensionsTests/ExtensionsTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -620,8 +615,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "ExtensionsTests/ExtensionsTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/FURRExtensions.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/FURRExtensions.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/FURRExtensions.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/FURRExtensions.xcodeproj/xcshareddata/xcschemes/Extensions.xcscheme b/FURRExtensions.xcodeproj/xcshareddata/xcschemes/Extensions.xcscheme index 22eb4db..26df85d 100644 --- a/FURRExtensions.xcodeproj/xcshareddata/xcschemes/Extensions.xcscheme +++ b/FURRExtensions.xcodeproj/xcshareddata/xcschemes/Extensions.xcscheme @@ -1,6 +1,6 @@