Skip to content

Commit 29bb61c

Browse files
authored
Merge pull request #1 from devxoul/swift-4.0
Let's Swift 4.0
2 parents 2267416 + 25f6660 commit 29bb61c

12 files changed

Lines changed: 89 additions & 62 deletions

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0

.travis.yml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
osx_image: xcode8.3
1+
osx_image: xcode9
22
language: objective-c
33
sudo: required
44
env:
55
global:
66
- PROJECT="AlertReactor.xcodeproj"
7-
- SCHEME="AlertReactor"
8-
- IOS_SDK="iphonesimulator10.3"
7+
- SCHEME="AlertReactor-Package"
8+
- IOS_SDK="iphonesimulator11.0"
99
- FRAMEWORK="AlertReactor"
1010
matrix:
11-
- SDK="$IOS_SDK" TEST=1 DESTINATION="platform=iOS Simulator,name=iPhone 7,OS=10.3.1"
11+
- SDK="$IOS_SDK" DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=11.0"
1212

1313
install:
1414
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
@@ -19,26 +19,14 @@ before_script:
1919
- swift package generate-xcodeproj
2020

2121
script:
22-
- if [ $TEST == 1 ]; then
23-
xcodebuild clean build test
24-
-project "$PROJECT"
25-
-scheme "$SCHEME"
26-
-sdk "$SDK"
27-
-destination "$DESTINATION"
28-
-configuration Debug
29-
-enableCodeCoverage YES
30-
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c;
31-
else
32-
xcodebuild clean build
33-
-project "$PROJECT"
34-
-scheme "$SCHEME"
35-
-sdk "$SDK"
36-
-destination "$DESTINATION"
37-
-configuration Debug
38-
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c;
39-
fi
22+
- xcodebuild clean build test
23+
-project "$PROJECT"
24+
-scheme "$SCHEME"
25+
-sdk "$SDK"
26+
-destination "$DESTINATION"
27+
-configuration Debug
28+
-enableCodeCoverage YES
29+
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c
4030

4131
after_success:
42-
- if [ $TEST == 1 ]; then
43-
bash <(curl -s https://codecov.io/bash) -J 'AlertReactor' -X xcodeplist;
44-
fi
32+
- bash <(curl -s https://codecov.io/bash) -X xcodeplist -J 'AlertReactor'

AlertReactor.podspec

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ Pod::Spec.new do |s|
1010
s.source_files = "Sources/**/*.{swift,h,m}"
1111
s.frameworks = "UIKit"
1212
s.dependency "ReactorKit"
13-
s.dependency "RxSwift", ">= 3.0.0"
14-
s.dependency "RxCocoa", ">= 3.0.0"
13+
s.dependency "RxSwift", ">= 4.0.0"
14+
s.dependency "RxCocoa", ">= 4.0.0"
1515

1616
s.ios.deployment_target = "8.0"
17-
18-
s.pod_target_xcconfig = {
19-
"SWIFT_VERSION" => "3.1"
20-
}
2117
end

Package.resolved

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
// swift-tools-version:3.1
1+
// swift-tools-version:4.0
22

3-
import Foundation
43
import PackageDescription
54

6-
var dependencies: [Package.Dependency] = [
7-
.Package(url: "https://github.com/ReactiveX/RxSwift.git", majorVersion: 3),
8-
.Package(url: "https://github.com/ReactorKit/ReactorKit.git", majorVersion: 0),
9-
]
10-
11-
let isTest = ProcessInfo.processInfo.environment["TEST"] == "1"
12-
if isTest {
13-
dependencies.append(
14-
.Package(url: "https://github.com/devxoul/RxExpect.git", majorVersion: 0)
15-
)
16-
}
17-
185
let package = Package(
196
name: "AlertReactor",
20-
dependencies: dependencies
7+
products: [
8+
.library(name: "AlertReactor", targets: ["AlertReactor"]),
9+
],
10+
dependencies: [
11+
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "4.0.0")),
12+
.package(url: "https://github.com/ReactorKit/ReactorKit.git", .upToNextMajor(from: "1.0.0")),
13+
.package(url: "https://github.com/devxoul/RxExpect.git", .upToNextMajor(from: "1.0.0")),
14+
],
15+
targets: [
16+
.target(name: "AlertReactor", dependencies: ["ReactorKit", "RxCocoa"]),
17+
.testTarget(name: "AlertReactorTests", dependencies: ["AlertReactor", "RxExpect"]),
18+
]
2119
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AlertReactor
22

3-
![Swift](https://img.shields.io/badge/Swift-3.1-orange.svg)
3+
![Swift](https://img.shields.io/badge/Swift-4.0-orange.svg)
44
[![CocoaPods](http://img.shields.io/cocoapods/v/AlertReactor.svg)](https://cocoapods.org/pods/AlertReactor)
55
[![Build Status](https://travis-ci.org/devxoul/AlertReactor.svg?branch=master)](https://travis-ci.org/devxoul/AlertReactor)
66
[![Codecov](https://img.shields.io/codecov/c/github/devxoul/AlertReactor.svg)](https://codecov.io/gh/devxoul/AlertReactor)

Sources/AlertActionType.swift renamed to Sources/AlertReactor/AlertActionType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS) || os(tvOS)
12
import UIKit
23

34
public protocol AlertActionType: Equatable {
@@ -22,3 +23,4 @@ public extension UIAlertAction {
2223
self.isEnabled = action.isEnabled
2324
}
2425
}
26+
#endif

Sources/AlertController.swift renamed to Sources/AlertReactor/AlertController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS) || os(tvOS)
12
import UIKit
23

34
import ReactorKit
@@ -107,8 +108,8 @@ extension Reactive where Base: AlertControllerType {
107108
return ControlEvent(events: source)
108109
}
109110

110-
public var actions: UIBindingObserver<Base, [Base.AlertAction]> {
111-
return UIBindingObserver(UIElement: self.base) { alertController, actions in
111+
public var actions: Binder<[Base.AlertAction]> {
112+
return Binder(self.base) { alertController, actions in
112113
// do nothing if both old actions and new actions are empty
113114
guard !(alertController.actions.isEmpty && actions.isEmpty) else { return }
114115

@@ -142,3 +143,4 @@ extension Reactive where Base: AlertControllerType {
142143
}
143144
}
144145
}
146+
#endif
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS) || os(tvOS)
12
import ReactorKit
23
import RxSwift
34

@@ -62,3 +63,4 @@ open class AlertReactor<AlertAction: AlertActionType>: Reactor {
6263
return state
6364
}
6465
}
66+
#endif

Tests/AlertReactorTests/AlertControllerTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS) || os(tvOS)
12
import XCTest
23
import RxExpect
34
import RxTest
@@ -56,3 +57,4 @@ class AlertControllerTests: XCTestCase {
5657
XCTAssertEqual(controller.actions[3].style, .cancel)
5758
}
5859
}
60+
#endif

0 commit comments

Comments
 (0)