Skip to content
10 changes: 10 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
disabled_rules:
- opening_brace
included:
- Sources
- Tests

trailing_comma:
mandatory_comma: true

line_length: 200
2 changes: 1 addition & 1 deletion Sources/Atomic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public final class Atomic<Value> {

return try action(&_value)
}

/// Atomically perform an arbitrary action using the current value of the
/// variable.
///
Expand Down
6 changes: 3 additions & 3 deletions Sources/Disposable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public final class CompositeDisposable: Disposable {
self.disposables = Atomic(bag)
self.state = UnsafeAtomicState(DisposableState.active)
}

/// Initialize a `CompositeDisposable` containing the given sequence of
/// disposables.
///
Expand Down Expand Up @@ -231,7 +231,7 @@ public final class CompositeDisposable: Disposable {
/// - returns: An instance of `DisposableHandle` that can be used to opaquely
/// remove the disposable later (if desired).
@discardableResult
public static func +=(lhs: CompositeDisposable, rhs: @escaping () -> ()) -> Disposable? {
public static func +=(lhs: CompositeDisposable, rhs: @escaping () -> Void) -> Disposable? {
return lhs.add(rhs)
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@ extension ScopedDisposable where Inner == CompositeDisposable {
/// - returns: An instance of `DisposableHandle` that can be used to opaquely
/// remove the disposable later (if desired).
@discardableResult
public static func +=(lhs: ScopedDisposable<CompositeDisposable>, rhs: @escaping () -> ()) -> Disposable? {
public static func +=(lhs: ScopedDisposable<CompositeDisposable>, rhs: @escaping () -> Void) -> Disposable? {
return lhs.inner.add(rhs)
}
}
Expand Down
27 changes: 13 additions & 14 deletions Sources/Flatten.swift
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ extension SignalProducer {
public func concat(_ next: SignalProducer<Value, Error>) -> SignalProducer<Value, Error> {
return SignalProducer<SignalProducer<Value, Error>, Error>([ self.producer, next ]).flatten(.concat)
}

/// `concat`s `value` onto `self`.
///
/// - parameters:
Expand All @@ -404,7 +404,7 @@ extension SignalProducer {
public func concat(value: Value) -> SignalProducer<Value, Error> {
return self.concat(SignalProducer(value: value))
}

/// `concat`s `self` onto initial `previous`.
///
/// - parameters:
Expand All @@ -415,7 +415,7 @@ extension SignalProducer {
public func prefix(_ previous: SignalProducer<Value, Error>) -> SignalProducer<Value, Error> {
return previous.concat(self)
}

/// `concat`s `self` onto initial `value`.
///
/// - parameters:
Expand All @@ -433,10 +433,10 @@ private final class ConcurrentFlattenState<Value, Error: Swift.Error> {

/// The limit of active producers.
let limit: UInt

/// The number of active producers.
var activeCount: UInt = 0

/// The producers waiting to be started.
var queue: [Producer] = []

Expand All @@ -451,7 +451,7 @@ private final class ConcurrentFlattenState<Value, Error: Swift.Error> {
init(limit: UInt) {
self.limit = limit
}

/// Dequeue the next producer if one should be started.
///
/// - returns: The `Producer` to start or `nil` if no producer should be
Expand Down Expand Up @@ -489,7 +489,7 @@ extension Signal {
.flatten(.merge)
.startAndRetrieveSignal()
}

/// Merges the given signals into a single `Signal` that will emit all
/// values from each of them, and complete when all of them have completed.
///
Expand All @@ -511,7 +511,7 @@ extension SignalProducer {
{
return SignalProducer<Seq.Iterator.Element, NoError>(producers).flatten(.merge)
}

/// Merges the given producers into a single `SignalProducer` that will emit
/// all values from each of them, and complete when all of them have
/// completed.
Expand Down Expand Up @@ -645,7 +645,7 @@ extension SignalProducer where Value: SignalProducerConvertible, Error == Value.
private struct LatestState<Value, Error: Swift.Error> {
var outerSignalComplete: Bool = false
var innerSignalComplete: Bool = true

var replacingInnerSignal: Bool = false
}

Expand Down Expand Up @@ -790,7 +790,7 @@ extension Signal {
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> Signal<Inner.Value, Error> where Inner.Error == Error {
return map(transform).flatten(strategy)
}

/// Maps each event from `signal` to a new signal, then flattens the
/// resulting producers (into a signal of values), according to the
/// semantics of the given strategy.
Expand Down Expand Up @@ -822,7 +822,7 @@ extension Signal where Error == NoError {
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> Signal<Inner.Value, Inner.Error> {
return map(transform).flatten(strategy)
}

/// Maps each event from `signal` to a new signal, then flattens the
/// resulting signals (into a signal of values), according to the
/// semantics of the given strategy.
Expand Down Expand Up @@ -851,7 +851,7 @@ extension SignalProducer {
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> SignalProducer<Inner.Value, Error> where Inner.Error == Error {
return map(transform).flatten(strategy)
}

/// Maps each event from `self` to a new producer, then flattens the
/// resulting producers (into a producer of values), according to the
/// semantics of the given strategy.
Expand Down Expand Up @@ -880,7 +880,7 @@ extension SignalProducer where Error == NoError {
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> SignalProducer<Inner.Value, Error> where Inner.Error == Error {
return map(transform).flatten(strategy)
}

/// Maps each event from `self` to a new producer, then flattens the
/// resulting producers (into a producer of values), according to the
/// semantics of the given strategy.
Expand All @@ -897,7 +897,6 @@ extension SignalProducer where Error == NoError {
}
}


extension Signal {
/// Catches any failure that may occur on the input signal, mapping to a new
/// producer that starts in its place.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Property.swift
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ extension PropertyProtocol where Value == Bool {
public func negate() -> Property<Value> {
return self.lift { $0.negate() }
}

/// Create a property that computes a logical AND between the latest values of `self`
/// and `property`.
///
Expand All @@ -386,7 +386,7 @@ extension PropertyProtocol where Value == Bool {
public func and<P: PropertyProtocol>(_ property: P) -> Property<Value> where P.Value == Value {
return self.lift(SignalProducer.and)(property)
}

/// Create a property that computes a logical OR between the latest values of `self`
/// and `property`.
///
Expand Down
12 changes: 6 additions & 6 deletions Sources/Scheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ public final class QueueScheduler: DateScheduler {
}

public let queue: DispatchQueue

internal init(internalQueue: DispatchQueue) {
queue = internalQueue
}

/// Initializes a scheduler that will target the given queue with its
/// work.
///
Expand Down Expand Up @@ -544,20 +544,20 @@ public final class TestScheduler: DateScheduler {
public func run() {
advance(to: Date.distantFuture)
}

/// Rewinds the virtualized clock by the given interval.
/// This simulates that user changes device date.
///
/// - parameters:
/// - interval: An interval by which the current date will be retreated.
public func rewind(by interval: DispatchTimeInterval) {
lock.lock()

let newDate = currentDate.addingTimeInterval(-interval)
assert(currentDate.compare(newDate) != .orderedAscending)
_currentDate = newDate

lock.unlock()

}
}
Loading