File tree Expand file tree Collapse file tree 2 files changed +40
-40
lines changed Expand file tree Collapse file tree 2 files changed +40
-40
lines changed Original file line number Diff line number Diff line change @@ -38,46 +38,6 @@ extension ObservableType {
38
38
return self . map { $0 } . subscribe ( observer)
39
39
}
40
40
41
- /**
42
- Creates new subscription and sends elements to variable.
43
-
44
- In case error occurs in debug mode, `fatalError` will be raised.
45
- In case error occurs in release mode, `error` will be logged.
46
-
47
- - parameter to: Target variable for sequence elements.
48
- - returns: Disposable object that can be used to unsubscribe the observer.
49
- */
50
- public func bind( to variable: Variable < E > ) -> Disposable {
51
- return subscribe { e in
52
- switch e {
53
- case let . next( element) :
54
- variable. value = element
55
- case let . error( error) :
56
- let error = " Binding error to variable: \( error) "
57
- #if DEBUG
58
- rxFatalError ( error)
59
- #else
60
- print ( error)
61
- #endif
62
- case . completed:
63
- break
64
- }
65
- }
66
- }
67
-
68
- /**
69
- Creates new subscription and sends elements to variable.
70
-
71
- In case error occurs in debug mode, `fatalError` will be raised.
72
- In case error occurs in release mode, `error` will be logged.
73
-
74
- - parameter to: Target variable for sequence elements.
75
- - returns: Disposable object that can be used to unsubscribe the observer.
76
- */
77
- public func bind( to variable: Variable < E ? > ) -> Disposable {
78
- return self . map { $0 as E ? } . bind ( to: variable)
79
- }
80
-
81
41
/**
82
42
Subscribes to observable sequence using custom binder function.
83
43
Original file line number Diff line number Diff line change @@ -449,6 +449,46 @@ extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingSt
449
449
}
450
450
}
451
451
452
+ extension ObservableType {
453
+ /**
454
+ Creates new subscription and sends elements to variable.
452
455
456
+ In case error occurs in debug mode, `fatalError` will be raised.
457
+ In case error occurs in release mode, `error` will be logged.
458
+
459
+ - parameter to: Target variable for sequence elements.
460
+ - returns: Disposable object that can be used to unsubscribe the observer.
461
+ */
462
+ public func bind( to variable: Variable < E > ) -> Disposable {
463
+ return subscribe { e in
464
+ switch e {
465
+ case let . next( element) :
466
+ variable. value = element
467
+ case let . error( error) :
468
+ let error = " Binding error to variable: \( error) "
469
+ #if DEBUG
470
+ rxFatalError ( error)
471
+ #else
472
+ print ( error)
473
+ #endif
474
+ case . completed:
475
+ break
476
+ }
477
+ }
478
+ }
479
+
480
+ /**
481
+ Creates new subscription and sends elements to variable.
482
+
483
+ In case error occurs in debug mode, `fatalError` will be raised.
484
+ In case error occurs in release mode, `error` will be logged.
485
+
486
+ - parameter to: Target variable for sequence elements.
487
+ - returns: Disposable object that can be used to unsubscribe the observer.
488
+ */
489
+ public func bind( to variable: Variable < E ? > ) -> Disposable {
490
+ return self . map { $0 as E ? } . bind ( to: variable)
491
+ }
492
+ }
453
493
454
494
You can’t perform that action at this time.
0 commit comments