Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Update RxSwift to 6.0 #26

Open
wants to merge 1 commit into
base: swift/5.0
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ Carthage/Build

fastlane/report.xml
fastlane/screenshots

# SPM
.swiftpm/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
- LC_CTYPE=en_US.UTF-8
- XCPROJ="-workspace RxAutomaton.xcworkspace -scheme RxAutomaton"

osx_image: xcode10.2
osx_image: xcode12.5

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" ~> 5.0
github "ReactiveX/RxSwift" ~> 6.0
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github "Quick/Nimble" "v8.0.2"
github "Quick/Quick" "v2.1.0"
github "ReactiveX/RxSwift" "5.0.1"
github "Quick/Nimble" "v9.2.0"
github "Quick/Quick" "v4.0.0"
github "ReactiveX/RxSwift" "6.2.0"
github "mrackwitz/xcconfigs" "3.0"
github "shu223/Pulsator" "0.4.2"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
Submodule Nimble updated 144 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 86 files
+2 −2 .github/ISSUE_TEMPLATE
+15 −0 .github/dependabot.yml
+58 −0 .github/workflows/ci-swiftpm.yml
+42 −0 .github/workflows/ci-xcode.yml
+36 −0 .github/workflows/cocoapods.yml
+20 −0 .github/workflows/danger.yml
+15 −0 .github/workflows/swiftlint.yml
+0 −4 .hound.yml
+0 −1 .swift-version
+11 −5 .swiftlint.yml
+0 −56 .travis.yml
+3 −3 CONTRIBUTING.md
+2 −6 Dangerfile
+27 −5 Documentation/en-us/InstallingQuick.md
+71 −2 Documentation/en-us/SharedExamples.md
+3 −3 Documentation/en-us/TestingApps.md
+4 −4 Documentation/ja/InstallingQuick.md
+4 −4 Documentation/ja/SharedExamples.md
+4 −4 Documentation/ko-kr/InstallingQuick.md
+3 −3 Documentation/ko-kr/SharedExamples.md
+4 −4 Documentation/pt-br/SharedExamples.md
+3 −3 Documentation/zh-cn/InstallingQuick.md
+2 −0 Documentation/zh-cn/README.md
+3 −3 Documentation/zh-cn/SharedExamples.md
+1 −1 Externals/Nimble
+1 −2 Gemfile
+74 −54 Gemfile.lock
+20 −2 Package.resolved
+9 −5 Package.swift
+0 −42 [email protected]
+2 −2 Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m
+9 −5 Quick.podspec
+323 −451 Quick.xcodeproj/project.pbxproj
+10 −14 Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme
+20 −14 Quick.xcodeproj/xcshareddata/xcschemes/Quick-macOS.xcscheme
+10 −14 Quick.xcodeproj/xcshareddata/xcschemes/Quick-tvOS.xcscheme
+4 −3 README.md
+5 −7 Rakefile
+8 −6 Sources/Quick/Behavior.swift
+3 −1 Sources/Quick/Callsite.swift
+22 −18 Sources/Quick/Configuration/Configuration.swift
+59 −20 Sources/Quick/Configuration/QuickConfiguration.swift
+9 −5 Sources/Quick/DSL/DSL.swift
+15 −14 Sources/Quick/DSL/World+DSL.swift
+37 −16 Sources/Quick/Example.swift
+7 −0 Sources/Quick/ExampleGroup.swift
+3 −1 Sources/Quick/ExampleMetadata.swift
+3 −1 Sources/Quick/Filter.swift
+1 −8 Sources/Quick/QuickMain.swift
+47 −38 Sources/Quick/QuickSpec.swift
+69 −0 Sources/Quick/QuickTestObservation.swift
+1 −1 Sources/Quick/String+C99ExtendedIdentifier.swift
+40 −18 Sources/Quick/World.swift
+5 −22 Sources/QuickObjCRuntime/QuickSpecBase.m
+5 −0 Sources/QuickObjCRuntime/include/QuickObjCRuntime.h
+7 −0 Sources/QuickObjCRuntime/include/QuickSpecBase.h
+2 −43 Sources/QuickObjectiveC/Configuration/QuickConfiguration.m
+3 −3 Sources/QuickObjectiveC/Quick.h
+58 −37 Sources/QuickObjectiveC/QuickSpec.m
+0 −11 Sources/QuickSpecBase/include/QuickSpecBase.h
+5 −0 Tests/.swiftlint.yml
+4 −3 Tests/LinuxMain.swift
+20 −0 Tests/QuickIssue853RegressionTests/SubclassOfSubclassWithStructPropertyTests.swift
+13 −2 Tests/QuickTests/QuickFocusedTests/FocusedTests.swift
+0 −31 Tests/QuickTests/QuickTestHelpers/SpecRunner.swift
+0 −4 Tests/QuickTests/QuickTestHelpers/TestRun.swift
+5 −5 Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift
+3 −3 Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift
+3 −3 Tests/QuickTests/QuickTests/FunctionalTests/BeforeSuiteTests.swift
+3 −5 Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/Configuration/AfterEach/Configuration+AfterEachTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/Configuration/BeforeEach/Configuration+BeforeEachTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift
+2 −2 Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift
+64 −14 Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift
+13 −1 Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift
+52 −0 Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/SharedExamples+BeforeEachTests.swift
+2 −2 Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift
+1 −1 Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift
+56 −12 Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift
+20 −3 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift
+1 −1 script/release
+0 −5 script/travis-install-linux
+0 −4 script/travis-script-linux
+0 −10 script/travis-script-macos
2 changes: 1 addition & 1 deletion Carthage/Checkouts/RxSwift
Submodule RxSwift updated 598 files
22 changes: 2 additions & 20 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
{
"object": {
"pins": [
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "f8657642dfdec9973efc79cc68bcef43a653a2bc",
"version": "8.0.2"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "94df9b449508344667e5afc7e80f8bcbff1e4c37",
"version": "2.1.0"
}
},
{
"package": "RxSwift",
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
"state": {
"branch": null,
"revision": "b3e888b4972d9bc76495dd74d30a8c7fad4b9395",
"version": "5.0.1"
"revision": "7c17a6ccca06b5c107cfa4284e634562ddaf5951",
"version": "6.2.0"
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ let package = Package(
targets: ["RxAutomaton"]),
],
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"),
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "6.2.0"),
],
targets: [
.target(
name: "RxAutomaton",
dependencies: ["RxSwift", "RxCocoa"],
dependencies: ["RxSwift", "RxCocoa", "RxRelay"],
path: "Sources"),
]
)
Expand All @@ -31,8 +31,8 @@ if ProcessInfo.processInfo.environment.keys.contains("RXAUTOMATON_SPM_TEST") {

package.dependencies.append(
contentsOf: [
.package(url: "https://github.com/Quick/Quick.git", from: "2.1.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"),
.package(url: "https://github.com/Quick/Quick.git", from: "4.0.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "9.2.0"),
]
)
}
7 changes: 4 additions & 3 deletions RxAutomaton.podspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
Pod::Spec.new do |s|
s.name = "RxAutomaton"
s.version = "0.4.0"
s.version = "0.5.0"
s.summary = "RxSwift + State Machine, inspired by Redux and Elm."
s.homepage = "https://github.com/inamiy/RxAutomaton"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Yasuhiro Inami" => "[email protected]" }

s.ios.deployment_target = "8.0"
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.10"
s.watchos.deployment_target = "3.0"
s.tvos.deployment_target = "9.0"

s.source = { :git => "https://github.com/inamiy/RxAutomaton.git", :tag => "#{s.version}" }
s.source_files = "Sources/**/*.swift"

s.dependency "RxSwift", "~> 5.0"
s.dependency "RxSwift", "~> 6.0"
s.dependency "RxRelay", "~> 6.0"
end
9 changes: 5 additions & 4 deletions Sources/Automaton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import RxSwift
import RxRelay

//
// Terminology:
Expand All @@ -32,7 +33,7 @@ public final class Automaton<State, Input>

/// Current state.
/// - Todo: Use RxProperty https://github.com/inamiy/RxProperty
public let state: Variable<State>
public let state: BehaviorRelay<State>

private let _replyObserver: AnyObserver<Reply<State, Input>>

Expand Down Expand Up @@ -62,7 +63,7 @@ public final class Automaton<State, Input>
///
public init(state initialState: State, input inputSignal: Observable<Input>, mapping: @escaping EffectMapping, strategy: FlattenStrategy = .merge)
{
let stateProperty = Variable(initialState)
let stateProperty = BehaviorRelay(value: initialState)
self.state = stateProperty // TODO: AnyProperty(stateProperty)

let p = PublishSubject<Reply<State, Input>>()
Expand Down Expand Up @@ -153,11 +154,11 @@ extension Observable {

// No idea why this is not in RxSwift but RxCocoa...
extension ObservableType {
fileprivate func bindTo(_ variable: Variable<E>) -> Disposable {
fileprivate func bindTo(_ variable: BehaviorRelay<Element>) -> Disposable {
return subscribe { e in
switch e {
case let .next(element):
variable.value = element
variable.accept(element)
case let .error(error):
let error = "Binding error to variable: \(error)"
#if DEBUG
Expand Down
4 changes: 2 additions & 2 deletions Sources/RxSwift+Pipe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import RxSwift
extension ObservableType {

/// From ReactiveCocoa.
public static func pipe() -> (Observable<E>, AnyObserver<E>) {
let p = PublishSubject<E>()
public static func pipe() -> (Observable<Element>, AnyObserver<Element>) {
let p = PublishSubject<Element>()
return (p.asObservable(), AnyObserver(eventHandler: p.asObserver().on))
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/RxSwift+Then.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension ObservableType {

/// From ReactiveCocoa (naive implementation).
public func then<E2, O: ObservableConvertibleType>(_ second: O) -> Observable<E2>
where O.E == E2
where O.Element == E2
{
return self
.filter { _ in false }
Expand Down
4 changes: 2 additions & 2 deletions Tests/RxAutomatonTests/EffectMappingLatestSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class EffectMappingLatestSpec: QuickSpec
/// Sends `.loginOK` after delay, simulating async work during `.loggingIn`.
let loginOKProducer =
Observable.just(AuthInput.loginOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

/// Sends `.logoutOK` after delay, simulating async work during `.loggingOut`.
let logoutOKProducer =
Observable.just(AuthInput.logoutOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

let mappings: [Automaton.EffectMapping] = [
.login | .loggedOut => .loggingIn | loginOKProducer,
Expand Down
8 changes: 4 additions & 4 deletions Tests/RxAutomatonTests/EffectMappingSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class EffectMappingSpec: QuickSpec
/// Sends `.loginOK` after delay, simulating async work during `.loggingIn`.
let loginOKProducer =
Observable.just(AuthInput.loginOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

/// Sends `.logoutOK` after delay, simulating async work during `.loggingOut`.
let logoutOKProducer =
Observable.just(AuthInput.logoutOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

let mappings: [Automaton.EffectMapping] = [
.login | .loggedOut => .loggingIn | loginOKProducer,
Expand Down Expand Up @@ -128,12 +128,12 @@ class EffectMappingSpec: QuickSpec
/// Sends `.loginOK` after delay, simulating async work during `.loggingIn`.
let loginOKProducer =
Observable.just(AuthInput.loginOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

/// Sends `.logoutOK` after delay, simulating async work during `.loggingOut`.
let logoutOKProducer =
Observable.just(AuthInput.logoutOK)
.delay(1, onScheduler: testScheduler)
.delay(.seconds(1), onScheduler: testScheduler)

let mapping: EffectMapping = { fromState, input in
switch (fromState, input) {
Expand Down
8 changes: 4 additions & 4 deletions Tests/RxAutomatonTests/Fixtures/ToRACHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import RxSwift
// R-A-C! R-A-C!

extension ObservableType {
func delay(_ time: TimeInterval, onScheduler scheduler: SchedulerType) -> Observable<E> {
func delay(_ time: DispatchTimeInterval, onScheduler scheduler: SchedulerType) -> Observable<Element> {
return self.flatMap { element in
return Observable<Int>.interval(time, scheduler: scheduler)
.map { _ in element }
Expand All @@ -23,18 +23,18 @@ extension ObservableType {

extension ObservableType {
@discardableResult
func observeValues(_ next: @escaping (E) -> Void) -> Disposable {
func observeValues(_ next: @escaping (Element) -> Void) -> Disposable {
return self.subscribe(onNext: next)
}

@discardableResult
func observe(_ observer: @escaping (Event<E>) -> Void) -> Disposable {
func observe(_ observer: @escaping (Event<Element>) -> Void) -> Disposable {
return self.subscribe(AnyObserver(eventHandler: observer))
}
}

extension ObserverType {
func send(next value: E) {
func send(next value: Element) {
self.onNext(value)
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/RxAutomatonTests/TerminatingSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class TerminatingSpec: QuickSpec


let sendInput1And2AfterDelay: Observable<MyInput> = Observable.concat([
Observable.just(.input1).delay(1, onScheduler: testScheduler),
Observable.just(.input2).delay(1, onScheduler: testScheduler),
Observable.just(.input1).delay(.seconds(1), onScheduler: testScheduler),
Observable.just(.input2).delay(.seconds(1), onScheduler: testScheduler),
])

let mappings: [Automaton.EffectMapping] = [
Expand Down