diff --git a/Closures.podspec.json b/Closures.podspec.json new file mode 100644 index 0000000..9f959cc --- /dev/null +++ b/Closures.podspec.json @@ -0,0 +1,23 @@ +{ + "name": "Closures", + "version": "0.5", + "summary": "Swifty closures for UIKit and Foundation", + "homepage": "https://github.com/vhesener/Closures", + "screenshots": [ + "https://raw.githubusercontent.com/vhesener/Closures/assets/assets/playground_general.gif", + "https://raw.githubusercontent.com/vhesener/Closures/assets/assets/reference_large.png" + ], + "license": "MIT", + "authors": "Vinnie Hesener", + "platforms": { + "ios": "9.0" + }, + "source": { + "git": "https://github.com/vhesener/Closures.git", + "tag": "v0.5" + }, + "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.", + "pushed_with_swift_version": "5.0" +} diff --git a/Supporting/cocoapods/.swift-version b/Supporting/cocoapods/.swift-version index 8012ebb..6e63660 100644 --- a/Supporting/cocoapods/.swift-version +++ b/Supporting/cocoapods/.swift-version @@ -1 +1 @@ -4.2 \ No newline at end of file +5.0 \ No newline at end of file diff --git a/Supporting/cocoapods/Closures.podspec.json b/Supporting/cocoapods/Closures.podspec.json index 445ab10..7528da5 100644 --- a/Supporting/cocoapods/Closures.podspec.json +++ b/Supporting/cocoapods/Closures.podspec.json @@ -1,6 +1,6 @@ { "name": "Closures", - "version": "0.5", + "version": "0.6", "summary": "Swifty closures for UIKit and Foundation", "homepage": "https://github.com/vhesener/Closures", "screenshots": [ @@ -14,7 +14,7 @@ }, "source": { "git": "https://github.com/vhesener/Closures.git", - "tag": "v0.5" + "tag": "v0.6" }, "source_files": "Xcode/Closures/Source", "documentation_url": "https://vhesener.github.io/Closures/", diff --git a/Xcode/Closures.xcodeproj/project.pbxproj b/Xcode/Closures.xcodeproj/project.pbxproj index 49a9dd1..a6eccd1 100644 --- a/Xcode/Closures.xcodeproj/project.pbxproj +++ b/Xcode/Closures.xcodeproj/project.pbxproj @@ -202,7 +202,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Your Mom"; TargetAttributes = { 3F7620DD1D849B5000E17BF5 = { @@ -219,10 +219,11 @@ }; buildConfigurationList = 3F7620D81D849B5000E17BF5 /* Build configuration list for PBXProject "Closures" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 3F7620D41D849B5000E17BF5; productRefGroup = 3F7620DF1D849B5000E17BF5 /* Products */; @@ -300,6 +301,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -354,7 +356,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -365,6 +367,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -411,7 +414,7 @@ SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -438,7 +441,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -460,7 +463,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -473,7 +476,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.vhesener.ClosuresTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -486,7 +489,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.vhesener.ClosuresTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme b/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme index 92cb476..6a00b26 100644 --- a/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme +++ b/Xcode/Closures.xcodeproj/xcshareddata/xcschemes/Closures.xcscheme @@ -1,6 +1,6 @@ : delegates: inout Set>, bind: (_ delegator: Delegator, _ delegate: Delegate) -> Void, with updateHandler: (_ wrapper: DelegateWrapper) -> Void) { - let wrapper = self.wrapper(delegator: delegator, delegate: delegate, delegates: &delegates, bind: bind) + let wrapper = self.wrapper(delegator: delegator, delegate: delegate(), delegates: &delegates, bind: bind) updateHandler(wrapper) bind(delegator, wrapper.delegate) } diff --git a/Xcode/Closures/Source/UIBarButtonItem.swift b/Xcode/Closures/Source/UIBarButtonItem.swift index 9a0f1c4..57df48f 100644 --- a/Xcode/Closures/Source/UIBarButtonItem.swift +++ b/Xcode/Closures/Source/UIBarButtonItem.swift @@ -33,7 +33,7 @@ public extension UIBarButtonItem { * parameter style: The `UIBarButtonItemStyle` of the button * parameter handler: The closure that is called when the button is tapped */ - public convenience init(image: UIImage?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { + convenience init(image: UIImage?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { self.init(image: image, style: style, target: nil, action: nil) onTap(handler: handler) } @@ -49,7 +49,7 @@ public extension UIBarButtonItem { * parameter handler: The closure that is called when the button is tapped */ @available(iOS 5.0, *) - public convenience init(image: UIImage?, landscapeImagePhone: UIImage?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { + convenience init(image: UIImage?, landscapeImagePhone: UIImage?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { self.init(image: image, landscapeImagePhone: landscapeImagePhone, style: style, target: nil, action: nil) onTap(handler: handler) } @@ -63,7 +63,7 @@ public extension UIBarButtonItem { * parameter style: The `UIBarButtonItemStyle` of the button * parameter handler: The closure that is called when the button is tapped */ - public convenience init(title: String?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { + convenience init(title: String?, style: UIBarButtonItem.Style, handler: @escaping () -> Void) { self.init(title: title, style: style, target: nil, action: nil) onTap(handler: handler) } @@ -76,7 +76,7 @@ public extension UIBarButtonItem { * parameter barButtonSystemItem: The `UIBarButtonSystemItem` to be used for the button * parameter handler: The closure that is called when the button is tapped */ - public convenience init(barButtonSystemItem systemItem: UIBarButtonItem.SystemItem, handler: @escaping () -> Void) { + convenience init(barButtonSystemItem systemItem: UIBarButtonItem.SystemItem, handler: @escaping () -> Void) { self.init(barButtonSystemItem: systemItem, target: nil, action: nil) onTap(handler: handler) } @@ -98,7 +98,7 @@ public extension UIBarButtonItem { * parameter handler: The closure that will be called when the tap is recognized. */ - public func onTap(handler: @escaping () -> Void) { + func onTap(handler: @escaping () -> Void) { target = self action = #selector(UIBarButtonItem.buttonTapped) NotificationCenter.selfObserve(name: .barButtonItemTapped, target: self) { button, userInfo in diff --git a/Xcode/Closures/Source/UIControl.swift b/Xcode/Closures/Source/UIControl.swift index 0fb831a..50a6b92 100644 --- a/Xcode/Closures/Source/UIControl.swift +++ b/Xcode/Closures/Source/UIControl.swift @@ -21,7 +21,7 @@ import UIKit fileprivate extension UIControl { - fileprivate func _onChange( + func _onChange( callerHandler: @escaping (_ value: ValueType) -> (Void), valueHandler: @escaping (_ control: ControlType) -> (ValueType)) { on(.valueChanged) { control, _ in diff --git a/Xcode/Closures/Source/UIImagePickerController.swift b/Xcode/Closures/Source/UIImagePickerController.swift index 62e38f4..e1e145b 100644 --- a/Xcode/Closures/Source/UIImagePickerController.swift +++ b/Xcode/Closures/Source/UIImagePickerController.swift @@ -325,7 +325,7 @@ extension UIImagePickerController.MediaFilter: ExpressibleByIntegerLiteral { } fileprivate extension CFString { - fileprivate var mediaFilter: UIImagePickerController.MediaFilter { + var mediaFilter: UIImagePickerController.MediaFilter { switch self { case kUTTypeImage: return .image diff --git a/Xcode/Playground/ClosuresDemo.playground/Setup.o b/Xcode/Playground/ClosuresDemo.playground/Setup.o new file mode 100644 index 0000000..2672ff0 Binary files /dev/null and b/Xcode/Playground/ClosuresDemo.playground/Setup.o differ