Skip to content

Commit

Permalink
Swift 5 upgrade (#49)
Browse files Browse the repository at this point in the history
Upgraded Swift version to 5.0
  • Loading branch information
vhesener authored Mar 26, 2019
1 parent a9a6977 commit ff79e5e
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 20 deletions.
23 changes: 23 additions & 0 deletions Closures.podspec.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion Supporting/cocoapods/.swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.0
4 changes: 2 additions & 2 deletions Supporting/cocoapods/Closures.podspec.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -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/",
Expand Down
19 changes: 11 additions & 8 deletions Xcode/Closures.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Your Mom";
TargetAttributes = {
3F7620DD1D849B5000E17BF5 = {
Expand All @@ -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 */;
Expand Down Expand Up @@ -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++";
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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++";
Expand Down Expand Up @@ -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";
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Xcode/Closures/Source/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DelegateWrapper<Delegator: DelegatorProtocol, Delegate: DelegateProtocol>:
delegates: inout Set<DelegateWrapper<Delegator,Delegate>>,
bind: (_ delegator: Delegator, _ delegate: Delegate) -> Void,
with updateHandler: (_ wrapper: DelegateWrapper<Delegator, Delegate>) -> 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)
}
Expand Down
10 changes: 5 additions & 5 deletions Xcode/Closures/Source/UIBarButtonItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Xcode/Closures/Source/UIControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import UIKit

fileprivate extension UIControl {
fileprivate func _onChange<ControlType, ValueType>(
func _onChange<ControlType, ValueType>(
callerHandler: @escaping (_ value: ValueType) -> (Void),
valueHandler: @escaping (_ control: ControlType) -> (ValueType)) {
on(.valueChanged) { control, _ in
Expand Down
2 changes: 1 addition & 1 deletion Xcode/Closures/Source/UIImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file not shown.

0 comments on commit ff79e5e

Please sign in to comment.