Skip to content

Commit

Permalink
Update dependencies to RAC 4 RC 2
Browse files Browse the repository at this point in the history
  • Loading branch information
neilpa committed Jan 21, 2016
1 parent 715c07f commit 40169a8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.1"
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.2"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "antitypical/Result" "1.0.1"
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.1"
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.2"
18 changes: 18 additions & 0 deletions Source/Property.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public struct AndProperty: PropertyType {
}
}

public var signal: Signal<Bool, NoError> {
let signals = terms.map { $0.signal }
return combineLatest(signals).map { values in
return values.reduce(true) { $0 && $1 }
}
}

/// Creates a new property with an additional conjunctive term.
public func and<P : PropertyType where P.Value == Bool>(other: P) -> AndProperty {
return AndProperty(terms: terms + [AnyProperty(other)])
Expand Down Expand Up @@ -80,6 +87,13 @@ public struct OrProperty: PropertyType {
}
}

public var signal: Signal<Bool, NoError> {
let signals = terms.map { $0.signal }
return combineLatest(signals).map { values in
return values.reduce(false) { $0 || $1 }
}
}

/// Creates a new property with an additional disjunctive term.
public func or<P : PropertyType where P.Value == Bool>(other: P) -> OrProperty {
return OrProperty(terms: terms + [AnyProperty(other)])
Expand Down Expand Up @@ -108,6 +122,10 @@ public struct NotProperty: PropertyType {
return source.producer.map { $0 != self.invert }
}

public var signal: Signal<Bool, NoError> {
return source.signal.map { $0 != self.invert }
}

/// A negated property of `self`.
public func not() -> NotProperty {
return NotProperty(source: source, invert: !invert)
Expand Down
2 changes: 1 addition & 1 deletion Source/SignalProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension SignalProducerType {
lock.lock()
var group = groups[key]
if group == nil {
let (producer, sink) = SignalProducer<Value, Error>.buffer()
let (producer, sink) = SignalProducer<Value, Error>.buffer(Int.max)
observer.sendNext(key, producer)

groups[key] = sink
Expand Down
2 changes: 1 addition & 1 deletion Tests/SignalProducerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
final class SignalProducerTests: XCTestCase {

func testGroupBy() {
let (producer, sink) = SignalProducer<Int, NoError>.buffer()
let (producer, sink) = SignalProducer<Int, NoError>.buffer(Int.max)
var evens: [Int] = []
var odds: [Int] = []
let disposable = CompositeDisposable()
Expand Down

0 comments on commit 40169a8

Please sign in to comment.