@@ -1444,18 +1444,37 @@ extension Signal {
14441444
14451445 /// Forward events from `self` with history: values of the returned signal
14461446 /// are a tuples whose first member is the previous value and whose second member
1447- /// is the current value.
1448- ///
1449- /// If an initial value is given, the returned `Signal` would emit tuples as soon as
1450- /// the first value is received. If `initial` is nil, the returned `Signal` would not
1451- /// emit any tuple until it has received at least two values.
1447+ /// is the current value. `initial` is supplied as the first member when `self`
1448+ /// sends its first value.
14521449 ///
14531450 /// - parameters:
1454- /// - initial: An optional initial value.
1451+ /// - initial: A value that will be combined with the first value sent by
1452+ /// `self`.
14551453 ///
14561454 /// - returns: A signal that sends tuples that contain previous and current
14571455 /// sent values of `self`.
1458- public func combinePrevious( _ initial: Value ? = nil ) -> Signal < ( Value , Value ) , Error > {
1456+ public func combinePrevious( _ initial: Value ) -> Signal < ( Value , Value ) , Error > {
1457+ return combinePrevious ( initial: initial)
1458+ }
1459+
1460+ /// Forward events from `self` with history: values of the returned signal
1461+ /// are a tuples whose first member is the previous value and whose second member
1462+ /// is the current value.
1463+ ///
1464+ /// The returned `Signal` would not emit any tuple until it has received at least two
1465+ /// values.
1466+ ///
1467+ /// - returns: A signal that sends tuples that contain previous and current
1468+ /// sent values of `self`.
1469+ public func combinePrevious( ) -> Signal < ( Value , Value ) , Error > {
1470+ return combinePrevious ( initial: nil )
1471+ }
1472+
1473+ /// Implementation detail of `combinePrevious`. A default argument of a `nil` initial
1474+ /// is deliberately avoided, since in the case of `Value` being an optional, the
1475+ /// `nil` literal would be materialized as `Optional<Value>.none` instead of `Value`,
1476+ /// thus changing the semantic.
1477+ private func combinePrevious( initial: Value ? ) -> Signal < ( Value , Value ) , Error > {
14591478 return Signal < ( Value , Value ) , Error > { observer in
14601479 var previous = initial
14611480
0 commit comments