Skip to content

Commit 5a2d16d

Browse files
authored
Merge branch 'master' into binding-target-keypath
2 parents d335ccd + 37b0c35 commit 5a2d16d

File tree

4 files changed

+35
-23
lines changed

4 files changed

+35
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
1. In Swift 3.2 or later, you may create `BindingTarget` for a key path of a specific object. (#440, kudos to @andersio)
55

6+
# 2.0.0-alpha.2
67
1. In Swift 3.2 or later, you can use `map()` with the new Smart Key Paths. (#435, kudos to @sharplet)
78

89
1. When composing `Signal` and `SignalProducer` of inhabitable types, e.g. `Never` or `NoError`, ReactiveSwift now warns about operators that are illogical to use, and traps at runtime when such operators attempt to instantiate an instance. (#429, kudos to @andersio)

ReactiveSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "ReactiveSwift"
33
# Version goes here and will be used to access the git tag later on, once we have a first release.
4-
s.version = "2.0.0-alpha.1"
4+
s.version = "2.0.0-alpha.2"
55
s.summary = "Streams of values over time"
66
s.description = <<-DESC
77
ReactiveSwift is a Swift framework inspired by Functional Reactive Programming. It provides APIs for composing and transforming streams of values over time.

Sources/Scheduler.swift

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,37 +136,44 @@ public final class UIScheduler: Scheduler {
136136
/// begins.
137137
@discardableResult
138138
public func schedule(_ action: @escaping () -> Void) -> Disposable? {
139-
let disposable = AnyDisposable()
140-
let actionAndDecrement = {
141-
if !disposable.isDisposed {
139+
let positionInQueue = enqueue()
140+
141+
// If we're already running on the main queue, and there isn't work
142+
// already enqueued, we can skip scheduling and just execute directly.
143+
if positionInQueue == 1 && DispatchQueue.getSpecific(key: UIScheduler.dispatchSpecificKey) == UIScheduler.dispatchSpecificValue {
144+
action()
145+
dequeue()
146+
return nil
147+
} else {
148+
let disposable = AnyDisposable()
149+
150+
DispatchQueue.main.async {
151+
defer { self.dequeue() }
152+
guard !disposable.isDisposed else { return }
142153
action()
143154
}
144155

145-
#if os(Linux)
146-
self.queueLength.modify { $0 -= 1 }
147-
#else
148-
OSAtomicDecrement32(self.queueLength)
149-
#endif
156+
return disposable
150157
}
158+
}
151159

160+
private func dequeue() {
152161
#if os(Linux)
153-
let queued = self.queueLength.modify { value -> Int32 in
154-
value += 1
155-
return value
156-
}
162+
queueLength.modify { $0 -= 1 }
157163
#else
158-
let queued = OSAtomicIncrement32(queueLength)
164+
OSAtomicDecrement32(queueLength)
159165
#endif
166+
}
160167

161-
// If we're already running on the main queue, and there isn't work
162-
// already enqueued, we can skip scheduling and just execute directly.
163-
if queued == 1 && DispatchQueue.getSpecific(key: UIScheduler.dispatchSpecificKey) == UIScheduler.dispatchSpecificValue {
164-
actionAndDecrement()
165-
} else {
166-
DispatchQueue.main.async(execute: actionAndDecrement)
168+
private func enqueue() -> Int32 {
169+
#if os(Linux)
170+
return queueLength.modify { value -> Int32 in
171+
value += 1
172+
return value
167173
}
168-
169-
return disposable
174+
#else
175+
return OSAtomicIncrement32(queueLength)
176+
#endif
170177
}
171178
}
172179

script/gen-docs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ cp ../Logo/PNG/logo-Swift.png ${DOC_PATH}/Logo/PNG/logo-Swift.png
6666
cp ../Logo/PNG/JoinSlack.png ${DOC_PATH}/Logo/PNG/JoinSlack.png
6767
cp ../Logo/PNG/Docs.png ${DOC_PATH}/Logo/PNG/Docs.png
6868

69+
# Fix all readme links.
70+
perl -0777 -i -pe 's/"Documentation\/([a-zA-Z0-9-_]+)\.md/"\L$1\.html/g' ${DOC_PATH}/*.html
71+
perl -0777 -i -pe 's/"(a-zA-Z0-9-_]+)\.md/"\L$1\.html/g' ${DOC_PATH}/*.html
72+
6973
git add ${DOC_PATH}
7074

7175
# Ensure Jekyll is not running in `docs`.
@@ -78,7 +82,7 @@ git add ./reactiveswift/docs/latest
7882

7983
# Update the docset feed.
8084
rm ./reactiveswift/docs/ReactiveSwift.xml
81-
cp ../script/feed.xml.template ./reactiveswift/docs/ReactiveSwift.xml
85+
/bin/cp -f ../script/feed.xml.template ./reactiveswift/docs/ReactiveSwift.xml
8286
sed -i -- "s/FRAMEWORK_VERSION/${TRAVIS_TAG}/g" ./reactiveswift/docs/ReactiveSwift.xml
8387
git add ./reactiveswift/docs/ReactiveSwift.xml
8488

0 commit comments

Comments
 (0)