Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Swift version to 4.2, migrated to the new Hashable API #37

Merged
merged 5 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

27 changes: 14 additions & 13 deletions ActionKit.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Pod::Spec.new do |s|
s.name = "ActionKit"
s.version = "2.5.0"
s.summary = "ActionKit is an easy to use framework that wraps the target-action design paradigm into closures/blocks."
s.description = <<-DESC
ActionKit is a light-weight, easy to use framework that wraps the target-action design paradigm into a less verbose, cleaner format. It shortens target-action method calls by removing the target and replacing the selector with a closure.
DESC
s.homepage = "https://github.com/ActionKit/ActionKit"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Benjamin Hendricks" => "https://github.com/coolbnjmn" }
s.source = { :git => "https://github.com/ActionKit/ActionKit.git", :tag => s.version.to_s }
s.platform = :ios, '9.0'
s.requires_arc = true
s.source_files = 'ActionKit/*.swift'
s.name = "ActionKit"
s.version = "2.5.0"
s.summary = "ActionKit is an easy to use framework that wraps the target-action design paradigm into closures/blocks."
s.description = <<-DESC
ActionKit is a light-weight, easy to use framework that wraps the target-action design paradigm into a less verbose, cleaner format. It shortens target-action method calls by removing the target and replacing the selector with a closure.
DESC
s.homepage = "https://github.com/ActionKit/ActionKit"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Benjamin Hendricks" => "https://github.com/coolbnjmn" }
s.source = { :git => "https://github.com/ActionKit/ActionKit.git", :tag => s.version.to_s }
s.platform = :ios, '9.0'
s.requires_arc = true
s.swift_version = '4.2'
s.source_files = 'ActionKit/*.swift'
end
22 changes: 11 additions & 11 deletions ActionKit/ActionKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ public enum ActionKitControlType: Hashable {
case control(UIControl, UIControl.Event)
case gestureRecognizer(UIGestureRecognizer, String)
case barButtonItem(UIBarButtonItem)
public var hashValue: Int {
get {
switch self {
case .control(let control, let controlEvent):
return control.hashValue &* controlEvent.hashValue
case .gestureRecognizer(let recognizer, let name):
return recognizer.hashValue &* name.hashValue
case .barButtonItem(let barButtonItem):
return barButtonItem.hashValue
}

public func hash(into hasher: inout Hasher) {
switch self {
case .control(let control, let controlEvent):
hasher.combine(control)
hasher.combine(controlEvent)
case .gestureRecognizer(let recognizer, let name):
hasher.combine(recognizer)
hasher.combine(name)
case .barButtonItem(let barButtonItem):
hasher.combine(barButtonItem)
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions ActionKit/UIControl+ActionKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ extension ActionKitSingleton {
}

extension UIControl.Event: Hashable {
public var hashValue: Int {
return Int(rawValue)
}

public func hash(into hasher: inout Hasher) {
hasher.combine(rawValue)
}

public static var allValues: [UIControl.Event] {
return [.touchDown, .touchDownRepeat, .touchDragInside, .touchDragOutside, .touchDragEnter,
.touchDragExit, .touchUpInside, .touchUpOutside, .touchCancel, .valueChanged,
Expand Down
8 changes: 4 additions & 4 deletions ActionKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ActionKit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ActionKitDemo.app/ActionKitDemo";
};
name = Debug;
Expand All @@ -380,7 +380,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ActionKit.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ActionKitDemo.app/ActionKitDemo";
};
name = Release;
Expand Down Expand Up @@ -488,7 +488,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ActionKit.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -504,7 +504,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ActionKit.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ViewController: UIViewController {
// Part of making old test button changed to tapped. This is what ActionKit tries to avoid doing
// by removing the need to explicitly declare selector functions when a closure is all that's needed
@objc func tappedSelector(_ sender: UIButton!) {
self.oldTestButton.setTitle("Old Tapped!", for: UIControlState())
self.oldTestButton.setTitle("Old Tapped!", for: UIControl.State())
}

override func viewDidLoad() {
Expand Down