Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.

Commit be6b409

Browse files
committed
Fix compilation errors for swift 5.2
1 parent 395df83 commit be6b409

9 files changed

Lines changed: 36 additions & 29 deletions

.circleci/config.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
version: 2.1
55

6-
anchors:
6+
anchors:
77
- &test_device "iPhone Xs"
88
- &clean_before_build true
99
- &test_output_folder test_output
1010
- &default_executor
1111
macos:
12-
xcode: "11.0.0"
12+
xcode: "11.3.0"
1313

1414
env:
1515
global:
@@ -31,7 +31,7 @@ commands:
3131
steps:
3232
- fetch-pod-specs # Fetch the podspec repo changes first to be sure to always get the latest pods
3333
- run:
34-
command: |
34+
command: |
3535
cd <<parameters.path>>
3636
pod install --verbose
3737
@@ -56,7 +56,7 @@ commands:
5656
path: <<parameters.path>>
5757
test_output_folder: *test_output_folder
5858

59-
# We introduced two separate commands for projects and workspaces because we didnt find a generic and non-confusing way to introduce
59+
# We introduced two separate commands for projects and workspaces because we didnt find a generic and non-confusing way to introduce
6060
# a condition to only pass either the project or the workspace environment argument to the fastlane scan
6161
test_project_and_store_results:
6262
description: "Builds and tests a project and then stores the results of the tests as artifacts and test results report"
@@ -120,12 +120,18 @@ jobs:
120120
path: swiftlint.html
121121
destination: swiftlint.html
122122

123+
test-xcode11-4-beta-ios13:
124+
macos:
125+
xcode: "11.4.0"
126+
steps:
127+
- test_main_project
128+
123129
test-xcode10-ios12:
124130
macos:
125131
xcode: "10.3.0"
126132
steps:
127133
- test_main_project
128-
134+
129135
test-xcode11-ios13:
130136
<<: *default_executor
131137
steps:
@@ -144,5 +150,6 @@ workflows:
144150
- swiftlint
145151
- test-xcode10-ios12
146152
- test-xcode11-ios13
153+
- test-xcode11-4-beta-ios13
147154
- test-example-login
148-
155+

Flow/CoreSignal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class CoreSignal<Kind: SignalKind, Value> {
2424
public typealias Event = Flow.Event<Value>
2525
typealias EventType = Flow.EventType<Value>
2626

27-
internal init(onEventType: @escaping (@escaping (EventType) -> Void) -> Disposable, _ noTrailingClosure: Void = ()) {
27+
internal init(onEventType: @escaping (@escaping (EventType) -> Void) -> Disposable) {
2828
self.onEventType = onEventType
2929
}
3030
}

Flow/Signal+Scheduling.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public extension CoreSignal where Kind == Plain, Value == () {
7171
/// - Parameter delay: If provided will delay the first event by `delay`. If nil (default), `interval` will be used as the delay.
7272
convenience init(every interval: TimeInterval, delay: TimeInterval? = nil) {
7373
precondition(interval >= 0)
74-
self.init { callback in
74+
self.init(onValue: { callback in
7575
let bag = DisposeBag()
7676
guard interval.isFinite else { return bag }
7777

@@ -93,7 +93,7 @@ public extension CoreSignal where Kind == Plain, Value == () {
9393
timer.resume()
9494

9595
return bag
96-
}
96+
})
9797
}
9898

9999
/// Creates a new signal that will signal once after `delay` seconds. Shorter version of `Signal(just: ()).delay(by: ...)`

Flow/Signal+Transforms.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ public extension SignalProvider {
656656
/// - Note: At most one value is hold at a time and released when `readSignal` becomes true.
657657
func wait(until readSignal: ReadSignal<Bool>) -> Signal<Value> {
658658
let signal = providedSignal
659-
return Signal { callback in
659+
return Signal(onValue: { callback in
660660
let state = StateAndCallback(state: Value?.none, callback: callback)
661661

662662
state += signal.filter(on: .none) { _ in !readSignal.value }.onValue {
@@ -672,7 +672,7 @@ public extension SignalProvider {
672672
}.atValue(on: .none) { _ in state.protectedVal = nil }.onValue(on: .none, state.callback)
673673

674674
return state
675-
}
675+
})
676676
}
677677
}
678678

Flow/Signal+Utilities.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import Foundation
1111
public extension NotificationCenter {
1212
/// Returns a signal for notifications named `name`.
1313
func signal(forName name: Notification.Name?, object: Any? = nil) -> Signal<Notification> {
14-
return Signal { callback in
14+
return Signal(onValue: { callback in
1515
let observer = self.addObserver(forName: name, object: object, queue: nil, using: callback)
1616
return Disposer {
1717
self.removeObserver(observer)
1818
}
19-
}
19+
})
2020
}
2121
}
2222

Flow/UIControls+Extensions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public extension UIControl {
1515
///
1616
/// bag += textField.signal(for: .editingDidBegin).onValue { ... }
1717
func signal(for controlEvents: UIControl.Event) -> Signal<()> {
18-
return Signal { callback in
18+
return Signal(onValue: { callback in
1919
let targetAction = TargetAction()
2020
self.addTarget(targetAction, action: TargetAction.selector, for: controlEvents)
2121

@@ -28,7 +28,7 @@ public extension UIControl {
2828
self.updateAutomaticEnabling()
2929
}
3030
return bag
31-
}
31+
})
3232
}
3333
}
3434

@@ -148,7 +148,7 @@ public extension UIBarButtonItem {
148148

149149
extension UIGestureRecognizer: SignalProvider {
150150
public var providedSignal: ReadSignal<UIGestureRecognizer.State> {
151-
return Signal { callback in
151+
return Signal(onValue: { callback in
152152
let targetAction = TargetAction()
153153
self.addTarget(targetAction, action: TargetAction.selector)
154154
let bag = DisposeBag()
@@ -159,7 +159,7 @@ extension UIGestureRecognizer: SignalProvider {
159159
self.removeTarget(targetAction, action: TargetAction.selector)
160160
}
161161
return bag
162-
}.readable(initial: self.state)
162+
}).readable(initial: self.state)
163163
}
164164

165165
/// Returns a signal that will signal only for `state`, equivalent to `filter { $0 == forState }.toVoid()`

Flow/UIView+EditingMenu.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@ public extension UIView {
1414
/// Returns a signal that will signal when user selects the copy command from the editing menu.
1515
/// - Note: Will display an editing menu on long press including the pasteboard actions currently listened on.
1616
var copySignal: Signal<()> {
17-
return Signal { callback in
17+
return Signal(onValue: { callback in
1818
let bag = DisposeBag()
1919
bag += self.copyingView.copyCallbacker.addCallback(callback)
2020
bag += { self.cleanUpCopyingView() }
2121
return bag
22-
}
22+
})
2323
}
2424

2525
/// Returns a signal that will signal when user selects the paste command from the editing menu.
2626
/// - Note: Will display an editing menu on long press including the pasteboard actions currently listened on.
2727
var pasteSignal: Signal<()> {
28-
return Signal { callback in
28+
return Signal(onValue: { callback in
2929
let bag = DisposeBag()
3030
bag += self.copyingView.pasteCallbacker.addCallback(callback)
3131
bag += { self.cleanUpCopyingView() }
3232
return bag
33-
}
33+
})
3434
}
3535

3636
/// Returns a signal that will signal when user selects the cut command from the editing menu.
3737
/// - Note: Will display an editing menu on long press including the pasteboard actions currently listened on.
3838
var cutSignal: Signal<()> {
39-
return Signal { callback in
39+
return Signal(onValue: { callback in
4040
let bag = DisposeBag()
4141
bag += self.copyingView.cutCallbacker.addCallback(callback)
4242
bag += { self.cleanUpCopyingView() }
4343
return bag
44-
}
44+
})
4545
}
4646
}
4747

Flow/UIView+Signal.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public extension UIView {
9797

9898
private extension UIView {
9999
func signal<T>(for keyPath: KeyPath<CallbackerView, Callbacker<T>>) -> Signal<T> {
100-
return Signal { callback in
100+
return Signal(onValue: { callback in
101101
let view = (self.viewWithTag(987892442) as? CallbackerView) ?? {
102102
let view = CallbackerView(frame: self.bounds)
103103
view.autoresizingMask = [.flexibleWidth, .flexibleHeight] // trick so layoutsubViews is called when the view is resized
@@ -123,7 +123,7 @@ private extension UIView {
123123
bag += view[keyPath: keyPath].addCallback(callback)
124124

125125
return bag
126-
}
126+
})
127127
}
128128
}
129129

FlowTests/SignalProviderTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,10 @@ class SignalProviderTests: XCTestCase {
11351135
func testSharedSignal() {
11361136
let callbacker = Callbacker<Int>()
11371137
var s1 = 0
1138-
let s = Signal<Int> { c in
1138+
let s = Signal<Int>(onValue: { c in
11391139
s1 += 1
11401140
return callbacker.addCallback(c)
1141-
}
1141+
})
11421142

11431143
var s2 = 0
11441144
var s3 = 0
@@ -1179,10 +1179,10 @@ class SignalProviderTests: XCTestCase {
11791179
func testSharedRemoveAndAdd() {
11801180
let callbacker = Callbacker<Int>()
11811181
var s0 = 0
1182-
let s = Signal<Int> { c in
1182+
let s = Signal<Int>(onValue: { c in
11831183
s0 += 1
11841184
return callbacker.addCallback(c)
1185-
}
1185+
})
11861186

11871187
var s1 = 0
11881188
var s2 = 0

0 commit comments

Comments
 (0)