Skip to content

Commit

Permalink
Updated for Swift 5.0 (#76)
Browse files Browse the repository at this point in the history
* Updated for Swift 5.0

* Bump version to 6.1.0 since Swfit 5.0 is a breaking change

* Fixed OS version of Apple TV & Watch in travis script
  • Loading branch information
stephanheilner authored and artman committed Apr 11, 2019
1 parent 2425a4c commit e792eb5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode10.1
language: swift
osx_image: xcode10.2
env:
global:
- LC_CTYPE=en_US.UTF-8
Expand All @@ -17,12 +17,12 @@ env:
- DESTINATION="OS=10.1,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=11.4,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=12.1,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=5.1,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" POD_LINT="NO"
- DESTINATION="OS=12.2,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=5.2,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" POD_LINT="NO"

before_install:
- gem install slather -N
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
- gem install cocoapods --no-document --quiet

script:
- set -o pipefail
Expand Down
5 changes: 3 additions & 2 deletions Signals.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Signals'
s.version = '6.0.1'
s.version = '6.1.0'
s.license = 'MIT'
s.summary = 'Elegant eventing'
s.homepage = 'https://github.com/artman/Signals'
Expand All @@ -11,10 +11,11 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
s.osx.deployment_target = '10.11'

s.source_files = 'Signals/Signal.swift'
s.ios.source_files = 'Signals/iOS/*.swift'
s.tvos.source_files = 'Signals/iOS/*.swift'

s.swift_version = '4.2'
s.swift_version = '5.0'
end
15 changes: 12 additions & 3 deletions Signals.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,16 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Tuomas Artman";
TargetAttributes = {
720D11711A085314003C4361 = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
720D117C1A085315003C4361 = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
725B76B51C26558F001D04CC = {
CreatedOnToolsVersion = 7.2;
Expand All @@ -426,6 +426,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 720D11681A085314003C4361;
Expand Down Expand Up @@ -594,6 +595,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -652,6 +654,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -714,6 +717,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "artman.fi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Signals;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -731,6 +735,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "artman.fi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Signals;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -745,6 +750,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "artman.fi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -755,6 +761,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "artman.fi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -810,6 +817,7 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -829,6 +837,7 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
2 changes: 1 addition & 1 deletion Signals/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ final public class Signal<T> {
}

public extension Signal where T == Void {
public func fire() {
func fire() {
fire(())
}
}
Expand Down
4 changes: 2 additions & 2 deletions Signals/ios/UIBarButtonItem+Signals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UIKit
/// Extends UIBarButtonItem with signal for the action.
public extension UIBarButtonItem {
/// A signal that fires for each action event.
public var onAction: Signal<(Void)> {
var onAction: Signal<Void> {
return getOrCreateSignal()
}

Expand All @@ -23,7 +23,7 @@ public extension UIBarButtonItem {
static var SignalDictionaryKey = "signals_signalKey"
}

private func getOrCreateSignal() -> Signal<(Void)> {
private func getOrCreateSignal() -> Signal<Void> {
let key = "Action"
let dictionary = getOrCreateAssociatedObject(self, associativeKey: &AssociatedKeys.SignalDictionaryKey, defaultValue: NSMutableDictionary(), policy: objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)

Expand Down
30 changes: 15 additions & 15 deletions Signals/ios/UIControl+Signals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,72 +9,72 @@ import UIKit
/// Extends UIControl with signals for all ui control events.
public extension UIControl {
/// A signal that fires for each touch down control event.
public var onTouchDown: Signal<(Void)> {
var onTouchDown: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDown)
}

/// A signal that fires for each touch down repeat control event.
public var onTouchDownRepeat: Signal<(Void)> {
var onTouchDownRepeat: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDownRepeat)
}

/// A signal that fires for each touch drag inside control event.
public var onTouchDragInside: Signal<(Void)> {
var onTouchDragInside: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDragInside)
}

/// A signal that fires for each touch drag outside control event.
public var onTouchDragOutside: Signal<(Void)> {
var onTouchDragOutside: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDragOutside)
}

/// A signal that fires for each touch drag enter control event.
public var onTouchDragEnter: Signal<(Void)> {
var onTouchDragEnter: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDragEnter)
}

/// A signal that fires for each touch drag exit control event.
public var onTouchDragExit: Signal<(Void)> {
var onTouchDragExit: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchDragExit)
}

/// A signal that fires for each touch up inside control event.
public var onTouchUpInside: Signal<(Void)> {
var onTouchUpInside: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchUpInside)
}

/// A signal that fires for each touch up outside control event.
public var onTouchUpOutside: Signal<(Void)> {
var onTouchUpOutside: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchUpOutside)
}

/// A signal that fires for each touch cancel control event.
public var onTouchCancel: Signal<(Void)> {
var onTouchCancel: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.touchCancel)
}

/// A signal that fires for each value changed control event.
public var onValueChanged: Signal<(Void)> {
var onValueChanged: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.valueChanged)
}

/// A signal that fires for each editing did begin control event.
public var onEditingDidBegin: Signal<(Void)> {
var onEditingDidBegin: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.editingDidBegin)
}

/// A signal that fires for each editing changed control event.
public var onEditingChanged: Signal<(Void)> {
var onEditingChanged: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.editingChanged)
}

/// A signal that fires for each editing did end control event.
public var onEditingDidEnd: Signal<(Void)> {
var onEditingDidEnd: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.editingDidEnd)
}

/// A signal that fires for each editing did end on exit control event.
public var onEditingDidEndOnExit: Signal<(Void)> {
var onEditingDidEndOnExit: Signal<Void> {
return getOrCreateSignalForUIControlEvent(.editingDidEndOnExit)
}

Expand All @@ -100,7 +100,7 @@ public extension UIControl {
.editingDidEnd: "EditingDidEnd",
.editingDidEndOnExit: "EditingDidEndOnExit"]

private func getOrCreateSignalForUIControlEvent(_ event: UIControl.Event) -> Signal<(Void)> {
private func getOrCreateSignalForUIControlEvent(_ event: UIControl.Event) -> Signal<Void> {
guard let key = UIControl.eventToKey[event] else {
assertionFailure("Event type is not handled")
return Signal()
Expand Down

0 comments on commit e792eb5

Please sign in to comment.