@@ -262,7 +262,7 @@ scopedExample("`mapError`") {
262262Preserves only the values of the producer that pass the given predicate.
263263*/
264264scopedExample ( " `filter` " ) {
265- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
265+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
266266 . filter { $0 > 3 }
267267 . startWithValues { value in
268268 print ( value)
@@ -275,7 +275,7 @@ Returns a producer that will yield the first `count` values from the
275275input producer.
276276*/
277277scopedExample ( " `take(first:)` " ) {
278- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
278+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
279279 . take ( first: 2 )
280280 . startWithValues { value in
281281 print ( value)
@@ -288,7 +288,7 @@ Forwards all events onto the given scheduler, instead of whichever
288288scheduler they originally arrived upon.
289289*/
290290scopedExample ( " `observe(on:)` " ) {
291- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
291+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
292292 let completion = { print ( " is main thread? \( Thread . current. isMainThread) " ) }
293293
294294 baseProducer
@@ -391,8 +391,8 @@ least one value each. If either producer is interrupted, the returned producer
391391will also be interrupted.
392392*/
393393scopedExample ( " `combineLatest(with:)` " ) {
394- let producer1 = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
395- let producer2 = SignalProducer < Int , NoError > ( values : [ 1 , 2 ] )
394+ let producer1 = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
395+ let producer2 = SignalProducer < Int , NoError > ( [ 1 , 2 ] )
396396
397397 producer1
398398 . combineLatest ( with: producer2)
@@ -407,7 +407,7 @@ Returns a producer that will skip the first `count` values, then forward
407407everything afterward.
408408*/
409409scopedExample ( " `skip(first:)` " ) {
410- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
410+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
411411 . skip ( first: 2 )
412412 . startWithValues { value in
413413 print ( value)
@@ -427,7 +427,7 @@ the Event itself and then complete. When an Interrupted event is received,
427427the resulting producer will send the Event itself and then interrupt.
428428*/
429429scopedExample ( " `materialize` " ) {
430- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
430+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
431431 . materialize ( )
432432 . startWithValues { value in
433433 print ( value)
@@ -447,8 +447,8 @@ multiple times) by `sampler`, then complete once both input producers have
447447completed, or interrupt if either input producer is interrupted.
448448*/
449449scopedExample ( " `sample(on:)` " ) {
450- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
451- let sampledOnProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 ] )
450+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
451+ let sampledOnProducer = SignalProducer < Int , NoError > ( [ 1 , 2 ] )
452452 . map { _ in ( ) }
453453
454454 baseProducer
@@ -466,7 +466,7 @@ is the current value. `initial` is supplied as the first member when `self`
466466sends its first value.
467467*/
468468scopedExample ( " `combinePrevious` " ) {
469- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
469+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
470470 . combinePrevious ( 42 )
471471 . startWithValues { value in
472472 print ( " \( value) " )
@@ -482,7 +482,7 @@ producer returned from `scan`. That result is then passed to `combine` as the
482482first argument when the next value is emitted, and so on.
483483*/
484484scopedExample ( " `scan` " ) {
485- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
485+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
486486 . scan ( 0 , + )
487487 . startWithValues { value in
488488 print ( value)
@@ -494,7 +494,7 @@ scopedExample("`scan`") {
494494Like `scan`, but sends only the final value and then immediately completes.
495495*/
496496scopedExample ( " `reduce` " ) {
497- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
497+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
498498 . reduce ( 0 , + )
499499 . startWithValues { value in
500500 print ( value)
@@ -507,7 +507,7 @@ Forwards only those values from `self` which do not pass `isRepeat` with
507507respect to the previous value. The first value is always forwarded.
508508*/
509509scopedExample ( " `skipRepeats` " ) {
510- SignalProducer < Int , NoError > ( values : [ 1 , 1 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , 2 , 2 , 4 ] )
510+ SignalProducer < Int , NoError > ( [ 1 , 1 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , 2 , 2 , 4 ] )
511511 . skipRepeats ( == )
512512 . startWithValues { value in
513513 print ( value)
@@ -521,7 +521,7 @@ at which point the returned signal behaves exactly like `self`.
521521*/
522522scopedExample ( " `skip(while:)` " ) {
523523 // Note that trailing closure is used for `skip(while:)`.
524- SignalProducer < Int , NoError > ( values : [ 3 , 3 , 3 , 3 , 1 , 2 , 3 , 4 ] )
524+ SignalProducer < Int , NoError > ( [ 3 , 3 , 3 , 3 , 1 , 2 , 3 , 4 ] )
525525 . skip { $0 > 2 }
526526 . startWithValues { value in
527527 print ( value)
@@ -566,7 +566,7 @@ Waits until `self` completes and then forwards the final `count` values
566566on the returned producer.
567567*/
568568scopedExample ( " `take(last:)` " ) {
569- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
569+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
570570 . take ( last: 2 )
571571 . startWithValues { value in
572572 print ( value)
@@ -579,7 +579,7 @@ Unwraps non-`nil` values and forwards them on the returned signal, `nil`
579579values are dropped.
580580*/
581581scopedExample ( " `skipNil` " ) {
582- SignalProducer < Int ? , NoError > ( values : [ nil , 1 , 2 , nil , 3 , 4 , nil ] )
582+ SignalProducer < Int ? , NoError > ( [ nil , 1 , 2 , nil , 3 , 4 , nil ] )
583583 . skipNil ( )
584584 . startWithValues { value in
585585 print ( value)
@@ -593,8 +593,8 @@ Zips elements of two producers into pairs. The elements of any Nth pair
593593are the Nth elements of the two input producers.
594594*/
595595scopedExample ( " `zip(with:)` " ) {
596- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
597- let zippedProducer = SignalProducer < Int , NoError > ( values : [ 42 , 43 ] )
596+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
597+ let zippedProducer = SignalProducer < Int , NoError > ( [ 42 , 43 ] )
598598
599599 baseProducer
600600 . zip ( with: zippedProducer)
@@ -651,7 +651,7 @@ which case `replacement` will not be started, and none of its events will be
651651be forwarded. All values sent from `producer` are ignored.
652652*/
653653scopedExample ( " `then` " ) {
654- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
654+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
655655 let thenProducer = SignalProducer < Int , NoError > ( value: 42 )
656656
657657 baseProducer
@@ -686,7 +686,7 @@ a layer of caching in front of another `SignalProducer`.
686686This operator has the same semantics as `SignalProducer.buffer`.
687687*/
688688scopedExample ( " `replayLazily(upTo:)` " ) {
689- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 , 42 ] )
689+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 , 42 ] )
690690 . replayLazily ( upTo: 2 )
691691
692692 baseProducer. startWithValues { value in
@@ -712,7 +712,7 @@ If `self` or any of the created producers fail, the returned producer
712712will forward that failure immediately.
713713*/
714714scopedExample ( " `flatMap(.latest)` " ) {
715- SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
715+ SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
716716 . flatMap ( . latest) { SignalProducer ( value: $0 + 3 ) }
717717 . startWithValues { value in
718718 print ( value)
@@ -743,8 +743,8 @@ sampled (possibly multiple times) by `sampler`, then complete once both
743743input producers have completed, or interrupt if either input producer is interrupted.
744744*/
745745scopedExample ( " `sample(with:)` " ) {
746- let producer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 ] )
747- let sampler = SignalProducer < String , NoError > ( values : [ " a " , " b " ] )
746+ let producer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 ] )
747+ let sampler = SignalProducer < String , NoError > ( [ " a " , " b " ] )
748748
749749 let result = producer. sample ( with: sampler)
750750
@@ -759,7 +759,7 @@ Logs all events that the receiver sends.
759759By default, it will print to the standard output.
760760*/
761761scopedExample ( " `log events` " ) {
762- let baseProducer = SignalProducer < Int , NoError > ( values : [ 1 , 2 , 3 , 4 , 42 ] )
762+ let baseProducer = SignalProducer < Int , NoError > ( [ 1 , 2 , 3 , 4 , 42 ] )
763763
764764 baseProducer
765765 . logEvents ( identifier: " Playground is fun! " )
0 commit comments