From 52329420cb388dfb3e976a5b814d4ccb9a335519 Mon Sep 17 00:00:00 2001 From: Vinnie Hesener Date: Sat, 31 Mar 2018 11:28:35 -0500 Subject: [PATCH] Modernizing for Swift 4.1 Modernizing for Swift 4.1 --- Supporting/cocoapods/.swift-version | 1 + Supporting/cocoapods/.swift_version | 1 - Supporting/cocoapods/Closures.podspec.json | 5 ++--- Xcode/Closures.xcodeproj/project.pbxproj | 12 +++++++++--- .../xcshareddata/xcschemes/Closures.xcscheme | 8 +++----- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Xcode/Closures/Source/UIImagePickerController.swift | 2 +- .../ClosuresDemo.playground/Sources/Setup.swift | 2 +- 8 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 Supporting/cocoapods/.swift-version delete mode 100644 Supporting/cocoapods/.swift_version create mode 100644 Xcode/Closures.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Supporting/cocoapods/.swift-version b/Supporting/cocoapods/.swift-version new file mode 100644 index 0000000..8a36cd1 --- /dev/null +++ b/Supporting/cocoapods/.swift-version @@ -0,0 +1 @@ +4.1 \ No newline at end of file diff --git a/Supporting/cocoapods/.swift_version b/Supporting/cocoapods/.swift_version deleted file mode 100644 index 389f774..0000000 --- a/Supporting/cocoapods/.swift_version +++ /dev/null @@ -1 +0,0 @@ -4.0 \ No newline at end of file diff --git a/Supporting/cocoapods/Closures.podspec.json b/Supporting/cocoapods/Closures.podspec.json index 39949c1..6249195 100644 --- a/Supporting/cocoapods/Closures.podspec.json +++ b/Supporting/cocoapods/Closures.podspec.json @@ -1,6 +1,6 @@ { "name": "Closures", - "version": "0.3", + "version": "0.4", "summary": "Swifty closures for UIKit and Foundation", "homepage": "https://github.com/vhesener/Closures", "screenshots": [ @@ -14,9 +14,8 @@ }, "source": { "git": "https://github.com/vhesener/Closures.git", - "tag": "v0.3" + "tag": "v0.4" }, - "swift_version": "4.0", "source_files": "Xcode/Closures/Source", "documentation_url": "https://vhesener.github.io/Closures/", "description": "Closures is an iOS Framework that adds closure handlers to many of the popular\nUIKit and Foundation classes. Although this framework is a substitute for \nsome Cocoa Touch design patterns, such as Delegation and Data Sources, and \nTarget-Action, the authors make no claim regarding which is a better way to \naccomplish the same type of task. Most of the time it is a matter of style, \npreference, or convenience that will determine if any of these closure extensions \nare beneficial.\n\nWhether you’re a functional purist, dislike a particular API, or simply just \nwant to organize your code a little bit, you might enjoy using this library." diff --git a/Xcode/Closures.xcodeproj/project.pbxproj b/Xcode/Closures.xcodeproj/project.pbxproj index 2b718b9..8d7447e 100644 --- a/Xcode/Closures.xcodeproj/project.pbxproj +++ b/Xcode/Closures.xcodeproj/project.pbxproj @@ -202,7 +202,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Your Mom"; TargetAttributes = { 3F7620DD1D849B5000E17BF5 = { @@ -309,6 +309,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -316,6 +317,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -371,6 +373,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -378,6 +381,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -418,6 +422,7 @@ buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -440,6 +445,7 @@ buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -464,7 +470,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.vhesener.ClosuresTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; }; name = Debug; @@ -477,7 +483,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.vhesener.ClosuresTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; }; name = Release; diff --git a/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme b/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme index 5e90385..92cb476 100644 --- a/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme +++ b/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -57,7 +56,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Xcode/Closures.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Xcode/Closures.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Xcode/Closures.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Xcode/Closures/Source/UIImagePickerController.swift b/Xcode/Closures/Source/UIImagePickerController.swift index 049e1b6..82cf4f2 100644 --- a/Xcode/Closures/Source/UIImagePickerController.swift +++ b/Xcode/Closures/Source/UIImagePickerController.swift @@ -111,7 +111,7 @@ extension UIImagePickerController { cameraOverlayView = cameraOverlay self.showsCameraControls = showsCameraControls } - mediaTypes = UIImagePickerController.MediaFilter.allTypes.flatMap { + mediaTypes = UIImagePickerController.MediaFilter.allTypes.compactMap { allow.contains($0) ? $0.mediaType : nil } didFinishPickingMedia { [unowned self] in diff --git a/Xcode/Playground/ClosuresDemo.playground/Sources/Setup.swift b/Xcode/Playground/ClosuresDemo.playground/Sources/Setup.swift index 3d4e280..fb2ac52 100644 --- a/Xcode/Playground/ClosuresDemo.playground/Sources/Setup.swift +++ b/Xcode/Playground/ClosuresDemo.playground/Sources/Setup.swift @@ -26,7 +26,7 @@ open class BaseViewController: UIViewController {} public func getAllCountries() -> [String] { let locale = Locale(identifier:"en_US") - return Locale.isoRegionCodes.flatMap { + return Locale.isoRegionCodes.compactMap { locale.localizedString(forRegionCode: $0)! }.sorted() }