Skip to content

Commit b7c6ae4

Browse files
authored
Merge pull request #274 from eimantas/markup-updates
[WIP] Update documentation markup
2 parents 271d865 + aa4f12c commit b7c6ae4

File tree

9 files changed

+266
-54
lines changed

9 files changed

+266
-54
lines changed

Sources/Atomic.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ internal protocol AtomicStateProtocol {
2121
///
2222
/// - parameters:
2323
/// - expected: The expected state.
24+
/// - next: The state to transition to.
2425
///
2526
/// - returns:
2627
/// `true` if the transition succeeds. `false` otherwise.
@@ -69,6 +70,7 @@ internal struct UnsafeAtomicState<State: RawRepresentable>: AtomicStateProtocol
6970
///
7071
/// - parameters:
7172
/// - expected: The expected state.
73+
/// - next: The state to transition to.
7274
///
7375
/// - returns:
7476
/// `true` if the transition succeeds. `false` otherwise.

Sources/Disposable.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ public final class CompositeDisposable: Disposable {
112112
private var state: UnsafeAtomicState<DisposableState>
113113

114114
/// Represents a handle to a disposable previously added to a
115-
/// CompositeDisposable.
115+
/// `CompositeDisposable`.
116+
///
117+
/// - note: `add(_:)` method of `CompositeDisposable` creates instances of
118+
/// `DisposableHandle`.
116119
public final class DisposableHandle {
117120
private var state: UnsafeAtomicState<DisposableState>
118121
private var bagToken: RemovalToken?

Sources/Flatten.swift

Lines changed: 224 additions & 42 deletions
Large diffs are not rendered by default.

Sources/Lifetime.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import enum Result.NoError
44
/// Represents the lifetime of an object, and provides a hook to observe when
55
/// the object deinitializes.
66
public final class Lifetime {
7-
/// MARK: Type properties and methods
7+
// MARK: Type properties and methods
88

99
/// Factory method for creating a `Lifetime` and its associated `Token`.
10+
///
11+
/// - returns: A `(lifetime, token)` tuple.
1012
public static func make() -> (lifetime: Lifetime, token: Token) {
1113
let token = Token()
1214
return (Lifetime(token), token)
@@ -17,15 +19,15 @@ public final class Lifetime {
1719
return Lifetime(ended: .empty)
1820
}
1921

20-
/// MARK: Instance properties
22+
// MARK: Instance properties
2123

2224
/// A signal that sends a `completed` event when the lifetime ends.
2325
///
2426
/// - note: Consider using `Lifetime.observeEnded` if only a closure observer
2527
/// is to be attached.
2628
public let ended: Signal<(), NoError>
2729

28-
/// MARK: Initializers
30+
// MARK: Initializers
2931

3032
/// Initialize a `Lifetime` object with the supplied ended signal.
3133
///

Sources/Property.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public protocol PropertyProtocol: class, BindingSource {
3131
}
3232

3333
extension PropertyProtocol {
34+
/// Observe the property by sending all of future value changes to the
35+
/// given `observer` during the given `lifetime`.
36+
///
37+
/// - parameters:
38+
/// - observer: An observer to send the events to.
39+
/// - lifetime: A lifetime of the observing object.
3440
@discardableResult
3541
public func observe(_ observer: Observer<Value, NoError>, during lifetime: Lifetime) -> Disposable? {
3642
return producer.observe(observer, during: lifetime)

Sources/Reactive.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public struct Reactive<Base> {
2323
/// The `Base` instance the extensions would be invoked with.
2424
public let base: Base
2525

26-
// Construct a proxy.
27-
//
28-
// - parameters:
29-
// - base: The object to be proxied.
26+
/// Construct a proxy
27+
///
28+
/// - parameters:
29+
/// - base: The object to be proxied.
3030
fileprivate init(_ base: Base) {
3131
self.base = base
3232
}

Sources/Scheduler.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ public final class QueueScheduler: DateScheduler {
299299
/// Schedules a recurring action at the given interval with provided leeway,
300300
/// beginning at the given start time.
301301
///
302+
/// - precondition: `interval` must be non-negative number.
303+
/// - precondition: `leeway` must be non-negative number.
304+
///
302305
/// - parameters:
303306
/// - date: A date to schedule the first action for.
304307
/// - interval: A repetition interval.
@@ -427,6 +430,8 @@ public final class TestScheduler: DateScheduler {
427430
/// Schedules a recurring action at the given interval, beginning at the
428431
/// given start date.
429432
///
433+
/// - precondition: `interval` must be non-negative.
434+
///
430435
/// - parameters:
431436
/// - date: A date to schedule the first action for.
432437
/// - interval: A repetition interval.

Sources/Signal.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,8 @@ extension SignalProtocol {
974974
/// - note: failed and `interrupted` events are always scheduled
975975
/// immediately.
976976
///
977+
/// - precondition: `interval` must be non-negative number.
978+
///
977979
/// - parameters:
978980
/// - interval: Interval to delay `value` and `completed` events by.
979981
/// - scheduler: A scheduler to deliver delayed events on.
@@ -1003,6 +1005,8 @@ extension SignalProtocol {
10031005

10041006
/// Skip first `count` number of values then act as usual.
10051007
///
1008+
/// - precondition: `count` must be non-negative number.
1009+
///
10061010
/// - parameters:
10071011
/// - count: A number of values to skip.
10081012
///
@@ -1739,6 +1743,8 @@ extension SignalProtocol {
17391743
/// a value is being throttled, and if there is a new value sent,
17401744
/// the new value will be passed anyway.
17411745
///
1746+
/// - precondition: `interval` must be non-negative number.
1747+
///
17421748
/// - parameters:
17431749
/// - interval: Number of seconds to wait between sent values.
17441750
/// - scheduler: A scheduler to deliver events on.
@@ -1913,6 +1919,8 @@ extension SignalProtocol {
19131919
/// that value will be discarded and the returned signal will
19141920
/// terminate immediately.
19151921
///
1922+
/// - precondition: `interval` must be non-negative number.
1923+
///
19161924
/// - parameters:
19171925
/// - interval: A number of seconds to wait before sending a value.
19181926
/// - scheduler: A scheduler to send values on.
@@ -2193,6 +2201,8 @@ extension SignalProtocol {
21932201
/// The signal must complete synchronously (or on a faster
21942202
/// scheduler) to avoid the timeout.
21952203
///
2204+
/// - precondition: `interval` must be non-negative number.
2205+
///
21962206
/// - parameters:
21972207
/// - error: Error to send with failed event if `self` is not completed
21982208
/// when `interval` passes.

Sources/SignalProducer.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ extension SignalProducerProtocol {
536536

537537
/// Yield an array of values until it reaches a certain count.
538538
///
539-
/// - precondition: `count` should be greater than zero.
539+
/// - precondition: `count` must be greater than zero.
540540
///
541541
/// - note: When the count is reached the array is sent and the signal
542542
/// starts over yielding a new array of values.
@@ -1682,6 +1682,8 @@ extension SignalProducerProtocol {
16821682
/// - note: Repeating `0` times results in a producer that instantly
16831683
/// completes.
16841684
///
1685+
/// - precondition: `count` must be non-negative integer.
1686+
///
16851687
/// - parameters:
16861688
/// - count: Number of repetitions.
16871689
///
@@ -2137,7 +2139,7 @@ private struct ReplayState<Value, Error: Swift.Error> {
21372139
/// - note: This timer will never complete naturally, so all invocations of
21382140
/// `start()` must be disposed to avoid leaks.
21392141
///
2140-
/// - precondition: Interval must be non-negative number.
2142+
/// - precondition: `interval` must be non-negative number.
21412143
///
21422144
/// - note: If you plan to specify an `interval` value greater than 200,000
21432145
/// seconds, use `timer(interval:on:leeway:)` instead
@@ -2160,9 +2162,9 @@ public func timer(interval: DispatchTimeInterval, on scheduler: DateScheduler) -
21602162
/// - note: This timer will never complete naturally, so all invocations of
21612163
/// `start()` must be disposed to avoid leaks.
21622164
///
2163-
/// - precondition: Interval must be non-negative number.
2165+
/// - precondition: `interval` must be non-negative number.
21642166
///
2165-
/// - precondition: Leeway must be non-negative number.
2167+
/// - precondition: `leeway` must be non-negative number.
21662168
///
21672169
/// - parameters:
21682170
/// - interval: An interval between invocations.

0 commit comments

Comments
 (0)