Skip to content

Commit

Permalink
Update swift 5.0 & XCode 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sugoi-wada committed Apr 2, 2019
1 parent 051ec8e commit 08f11e7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .swift-version
@@ -1 +1 @@
3.0
4.2.1
2 changes: 1 addition & 1 deletion ActionClosurable-Demo/AppDelegate.swift
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
2 changes: 1 addition & 1 deletion ActionClosurable-Demo/ViewController.swift
Expand Up @@ -37,7 +37,7 @@ class ViewController: UIViewController {
print("barButtonItem image")
}),
]
button?.setTitle("button", for: UIControlState())
button?.setTitle("button", for: UIControl.State())
button?.backgroundColor = UIColor.red
self.view.addSubview(button!)

Expand Down
37 changes: 27 additions & 10 deletions ActionClosurable.xcodeproj/project.pbxproj
Expand Up @@ -224,25 +224,26 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Yoshitaka Seki";
TargetAttributes = {
B61D45B01CBAB1AA00BCADB7 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 1020;
};
B6554A291CC24F3D0060DC4B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
B6554A4A1CC25F320060DC4B = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = B61D45981CBAB1AA00BCADB7 /* Build configuration list for PBXProject "ActionClosurable" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -358,14 +359,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -408,14 +417,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -450,7 +467,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = takasek.ActionClosurableTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -461,7 +478,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = takasek.ActionClosurableTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -480,7 +497,7 @@
PRODUCT_BUNDLE_IDENTIFIER = takasek.ActionClosurable;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -501,7 +518,7 @@
PRODUCT_BUNDLE_IDENTIFIER = takasek.ActionClosurable;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -516,7 +533,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "takasek.ActionClosurable-Demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -529,7 +546,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "takasek.ActionClosurable-Demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions ActionClosurable/ActionClosurable.swift
Expand Up @@ -32,12 +32,12 @@ private func register<T>(_ actor: Actor<T>, to object: AnyObject) {

public protocol ActionClosurable {}
public extension ActionClosurable where Self: AnyObject {
public func convert(closure: @escaping (Self) -> Void, toConfiguration configure: (AnyObject, Selector) -> Void) {
func convert(closure: @escaping (Self) -> Void, toConfiguration configure: (AnyObject, Selector) -> Void) {
let actor = Actor(acts: closure)
configure(actor, #selector(Actor<AnyObject>.act(sender:)))
register(actor, to: self)
}
public static func convert(closure: @escaping (Self) -> Void, toConfiguration configure: (AnyObject, Selector) -> Self) -> Self {
static func convert(closure: @escaping (Self) -> Void, toConfiguration configure: (AnyObject, Selector) -> Self) -> Self {
let actor = Actor(acts: closure)
let instance = configure(actor, #selector(Actor<AnyObject>.act(sender:)))
register(actor, to: instance)
Expand Down
12 changes: 6 additions & 6 deletions ActionClosurable/Extensions.swift
Expand Up @@ -9,7 +9,7 @@
import UIKit

extension ActionClosurable where Self: UIControl {
public func on(_ controlEvents: UIControlEvents, closure: @escaping (Self) -> Void) {
public func on(_ controlEvents: UIControl.Event, closure: @escaping (Self) -> Void) {
convert(closure: closure, toConfiguration: {
self.addTarget($0, action: $1, for: controlEvents)
})
Expand All @@ -23,11 +23,11 @@ extension ActionClosurable where Self: UIButton {
}

public extension ActionClosurable where Self: UIRefreshControl {
public func onValueChanged(closure: @escaping (Self) -> Void) {
func onValueChanged(closure: @escaping (Self) -> Void) {
on(.valueChanged, closure: closure)
}

public init(closure: @escaping (Self) -> Void) {
init(closure: @escaping (Self) -> Void) {
self.init()
onValueChanged(closure: closure)
}
Expand All @@ -47,19 +47,19 @@ extension ActionClosurable where Self: UIGestureRecognizer {
}

extension ActionClosurable where Self: UIBarButtonItem {
public init(title: String, style: UIBarButtonItemStyle, closure: @escaping (Self) -> Void) {
public init(title: String, style: UIBarButtonItem.Style, closure: @escaping (Self) -> Void) {
self.init()
self.title = title
self.style = style
self.onTap(closure)
}
public init(image: UIImage?, style: UIBarButtonItemStyle, closure: @escaping (Self) -> Void) {
public init(image: UIImage?, style: UIBarButtonItem.Style, closure: @escaping (Self) -> Void) {
self.init()
self.image = image
self.style = style
self.onTap(closure)
}
public init(barButtonSystemItem: UIBarButtonSystemItem, closure: @escaping (Self) -> Void) {
public init(barButtonSystemItem: UIBarButtonItem.SystemItem, closure: @escaping (Self) -> Void) {
self.init(barButtonSystemItem: barButtonSystemItem, target: nil, action: nil)
self.onTap(closure)
}
Expand Down
2 changes: 1 addition & 1 deletion ActionClosurableTests/ActionClosurableTests.swift
Expand Up @@ -28,7 +28,7 @@ class ActionClosurableTests: XCTestCase {

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
self.measure {
// Put the code you want to measure the time of here.
}
}
Expand Down

0 comments on commit 08f11e7

Please sign in to comment.