@@ -23,7 +23,7 @@ example("allowTrue") {
2323
2424 Observable . of ( true , false , false , true , true )
2525 . allowTrue ( )
26- . subscribe ( onNext: { print ( $0) } )
26+ . subscribe ( onNext: { dump ( $0) } )
2727 . disposed ( by: disposeBag)
2828
2929}
@@ -34,7 +34,7 @@ example("allowTrue Optional") {
3434
3535 Observable . of ( true , false , nil , true , nil , true )
3636 . allowTrue ( )
37- . subscribe ( onNext: { print ( $0) } )
37+ . subscribe ( onNext: { dump ( $0) } )
3838 . disposed ( by: disposeBag)
3939
4040}
@@ -45,7 +45,7 @@ example("allowFalse") {
4545
4646 Observable . of ( true , false , false , true , false )
4747 . allowFalse ( )
48- . subscribe ( onNext: { print ( $0) } )
48+ . subscribe ( onNext: { dump ( $0) } )
4949 . disposed ( by: disposeBag)
5050
5151}
@@ -56,7 +56,7 @@ example("allowFalse Optional") {
5656
5757 Observable . of ( true , false , nil , true , nil , true , false )
5858 . allowFalse ( )
59- . subscribe ( onNext: { print ( $0) } )
59+ . subscribe ( onNext: { dump ( $0) } )
6060 . disposed ( by: disposeBag)
6161
6262}
@@ -66,7 +66,7 @@ example("allowTrueOrNil") {
6666
6767 Observable . of ( true , false , nil , true , nil , true , false )
6868 . allowTrueOrNil ( )
69- . subscribe ( onNext: { print ( $0) } )
69+ . subscribe ( onNext: { dump ( $0) } )
7070 . disposed ( by: disposeBag)
7171
7272}
@@ -76,9 +76,9 @@ example("allowFalseOrNil") {
7676
7777 Observable . of ( true , false , nil , true , nil , true , false )
7878 . allowFalseOrNil ( )
79- . subscribe ( onNext: { print ( $0) } )
79+ . subscribe ( onNext: { dump ( $0) } )
8080 . disposed ( by: disposeBag)
81-
81+
8282}
8383
8484example ( " filterIfNil " ) {
@@ -91,14 +91,14 @@ example("filterIfNil") {
9191
9292 subject
9393 . filterIfNil ( optional)
94- . subscribe ( onNext: { print ( " Subscription1 --> \( $0 ) " ) } )
94+ . subscribe ( onNext: { dump ( $0 , name : " Subscription1 " ) } )
9595 . disposed ( by: disposeBag)
9696
9797 optional = " enable "
9898
9999 subject
100100 . filterIfNil ( optional)
101- . subscribe ( onNext: { print ( " Subscription2 --> \( $0 ) " ) } )
101+ . subscribe ( onNext: { dump ( $0 , name : " Subscription2 " ) } )
102102 . disposed ( by: disposeBag)
103103
104104 subject. onNext ( " 🐹 " )
@@ -116,32 +116,41 @@ example("filterIfNotNil") {
116116
117117 subject
118118 . filterIfNotNil ( optional)
119- . subscribe ( onNext: { print ( " Subscription1 --> \( $0 ) " ) } )
119+ . subscribe ( onNext: { dump ( $0 , name : " Subscription1 " ) } )
120120 . disposed ( by: disposeBag)
121121
122122 optional = " enable "
123123
124124 subject
125125 . filterIfNotNil ( optional)
126- . subscribe ( onNext: { print ( " Subscription2 --> \( $0 ) " ) } )
126+ . subscribe ( onNext: { dump ( $0 , name : " Subscription2 " ) } )
127127 . disposed ( by: disposeBag)
128128
129129 subject. onNext ( " 🐹 " )
130130
131131 subject. onNext ( " 🐭 " )
132132}
133133
134+ example ( " Allow nil " ) {
135+ let disposeBag = DisposeBag ( )
136+
137+ Observable . of ( true , false , nil , true , nil , true , false )
138+ . allowNil ( )
139+ . subscribe ( onNext: { dump ( $0) } )
140+ . disposed ( by: disposeBag)
141+ }
142+
134143/*:
135144 ## Map Extensions
136- */
145+ */
137146
138147example ( " map(to:) " ) {
139148
140149 let disposeBag = DisposeBag ( )
141150
142151 Observable . of ( 1 , 5 , 7 , 8 )
143152 . map ( to: " ping " )
144- . subscribe ( onNext: { print ( $0) } )
153+ . subscribe ( onNext: { dump ( $0 as String ) } )
145154 . disposed ( by: disposeBag)
146155
147156}
@@ -158,26 +167,26 @@ example("map(at:)") {
158167
159168 observable
160169 . map ( at: \. title)
161- . subscribe ( onNext: { print ( $0) } )
170+ . subscribe ( onNext: { dump ( $0) } )
162171 . disposed ( by: disposeBag)
163172
164173 observable
165174 . map ( at: \. author. firstName)
166- . subscribe ( onNext: { print ( $0) } )
175+ . subscribe ( onNext: { dump ( $0) } )
167176 . disposed ( by: disposeBag)
168177
169178}
170179
171180/*:
172181 ## Cast Extensions
173- */
182+ */
174183
175184example ( " cast(to:) " ) {
176185 let disposeBag = DisposeBag ( )
177186
178187 Observable < CustomStringConvertible > . of ( " 1 " , " 5 " , " 7 " , " 8 " )
179188 . cast ( to: String . self)
180- . subscribe ( onNext: { print ( $0) } )
189+ . subscribe ( onNext: { dump ( $0) } )
181190 . disposed ( by: disposeBag)
182191
183192}
@@ -187,7 +196,7 @@ example("forceCast(to:)") {
187196
188197 Observable < CustomStringConvertible > . of ( " 1 " , " 5 " , " 7 " , " 8 " )
189198 . forceCast ( to: String . self)
190- . subscribe ( onNext: { print ( $0) } )
199+ . subscribe ( onNext: { dump ( $0) } )
191200 . disposed ( by: disposeBag)
192201
193202}
0 commit comments