@@ -102,7 +102,7 @@ extension RACSignal {
102102 /// - line: Current line in file.
103103 ///
104104 /// - returns: Signal producer created from `self`.
105- public func toSignalProducer( file: String = #file, line: Int = #line) -> SignalProducer < AnyObject ? , NSError > {
105+ public func toSignalProducer( file: String = #file, line: Int = #line) -> SignalProducer < Any ? , NSError > {
106106 return SignalProducer { observer, disposable in
107107 let next = { obj in
108108 observer. sendNext ( obj)
@@ -121,65 +121,19 @@ extension RACSignal {
121121 }
122122}
123123
124- extension SignalProducerProtocol where Value : AnyObject {
124+ extension SignalProducerProtocol {
125125 /// Create a `RACSignal` that will `start()` the producer once for each
126126 /// subscription.
127127 ///
128128 /// - note: Any `interrupted` events will be silently discarded.
129129 ///
130130 /// - returns: `RACSignal` instantiated from `self`.
131131 public func toRACSignal( ) -> RACSignal {
132- return self
133- . lift { $0. optionalize ( ) }
134- . toRACSignal ( )
135- }
136- }
137-
138- extension SignalProducerProtocol where Value: OptionalProtocol , Value. Wrapped: AnyObject {
139- /// Create a `RACSignal` that will `start()` the producer once for each
140- /// subscription.
141- ///
142- /// - note: Any `interrupted` events will be silently discarded.
143- ///
144- /// - returns: `RACSignal` instantiated from `self`.
145- public func toRACSignal( ) -> RACSignal {
146- return self
147- . mapError { $0 as NSError }
148- . toRACSignal ( )
149- }
150- }
151-
152- extension SignalProducerProtocol where Value: AnyObject , Error: NSError {
153- /// Create a `RACSignal` that will `start()` the producer once for each
154- /// subscription.
155- ///
156- /// - note: Any `interrupted` events will be silently discarded.
157- ///
158- /// - returns: `RACSignal` instantiated from `self`.
159- public func toRACSignal( ) -> RACSignal {
160- return self
161- . lift { $0. optionalize ( ) }
162- . toRACSignal ( )
163- }
164- }
165-
166- extension SignalProducerProtocol where Value: OptionalProtocol , Value. Wrapped: AnyObject , Error: NSError {
167- /// Create a `RACSignal` that will `start()` the producer once for each
168- /// subscription.
169- ///
170- /// - note: Any `interrupted` events will be silently discarded.
171- ///
172- /// - returns: `RACSignal` instantiated from `self`.
173- public func toRACSignal( ) -> RACSignal {
174- // This special casing of `Error: NSError` is a workaround for
175- // rdar://22708537 which causes an NSError's UserInfo dictionary to get
176- // discarded during a cast from ErrorType to NSError in a generic
177- // function
178132 return RACSignal . createSignal { subscriber in
179133 let selfDisposable = self . start { event in
180134 switch event {
181135 case let . next( value) :
182- subscriber. sendNext ( value. optional )
136+ subscriber. sendNext ( value)
183137 case let . failed( error) :
184138 subscriber. sendError ( error)
185139 case . completed:
@@ -196,61 +150,18 @@ extension SignalProducerProtocol where Value: OptionalProtocol, Value.Wrapped: A
196150 }
197151}
198152
199- extension SignalProtocol where Value: AnyObject {
200- /// Create a `RACSignal` that will observe the given signal.
201- ///
202- /// - note: Any `interrupted` events will be silently discarded.
203- ///
204- /// - returns: `RACSignal` instantiated from `self`.
205- public func toRACSignal( ) -> RACSignal {
206- return self
207- . optionalize ( )
208- . toRACSignal ( )
209- }
210- }
211-
212- extension SignalProtocol where Value: AnyObject , Error: NSError {
153+ extension SignalProtocol {
213154 /// Create a `RACSignal` that will observe the given signal.
214155 ///
215156 /// - note: Any `interrupted` events will be silently discarded.
216157 ///
217158 /// - returns: `RACSignal` instantiated from `self`.
218159 public func toRACSignal( ) -> RACSignal {
219- return self
220- . optionalize ( )
221- . toRACSignal ( )
222- }
223- }
224-
225- extension SignalProtocol where Value: OptionalProtocol , Value. Wrapped: AnyObject {
226- /// Create a `RACSignal` that will observe the given signal.
227- ///
228- /// - note: Any `interrupted` events will be silently discarded.
229- ///
230- /// - returns: `RACSignal` instantiated from `self`.
231- public func toRACSignal( ) -> RACSignal {
232- return self
233- . mapError { $0 as NSError }
234- . toRACSignal ( )
235- }
236- }
237-
238- extension SignalProtocol where Value: OptionalProtocol , Value. Wrapped: AnyObject , Error: NSError {
239- /// Create a `RACSignal` that will observe the given signal.
240- ///
241- /// - note: Any `interrupted` events will be silently discarded.
242- ///
243- /// - returns: `RACSignal` instantiated from `self`.
244- public func toRACSignal( ) -> RACSignal {
245- // This special casing of `Error: NSError` is a workaround for
246- // rdar://22708537 which causes an NSError's UserInfo dictionary to get
247- // discarded during a cast from ErrorType to NSError in a generic
248- // function
249160 return RACSignal . createSignal { subscriber in
250161 let selfDisposable = self . observe { event in
251162 switch event {
252163 case let . next( value) :
253- subscriber. sendNext ( value. optional )
164+ subscriber. sendNext ( value)
254165 case let . failed( error) :
255166 subscriber. sendError ( error)
256167 case . completed:
@@ -285,14 +196,14 @@ extension RACCommand {
285196 /// - line: Current line in file.
286197 ///
287198 /// - returns: Action created from `self`.
288- public func toAction(file: String = #file, line: Int = #line) -> Action<AnyObject ?, AnyObject ?, NSError> {
199+ public func toAction(file: String = #file, line: Int = #line) -> Action<Any ?, Any ?, NSError> {
289200 let enabledProperty = MutableProperty(true)
290201
291202 enabledProperty <~ self.enabled.toSignalProducer()
292203 .map { $0 as! Bool }
293204 .flatMapError { _ in SignalProducer<Bool, NoError>(value: false) }
294205
295- return Action(enabledIf: enabledProperty) { input -> SignalProducer<AnyObject ?, NSError> in
206+ return Action(enabledIf: enabledProperty) { input -> SignalProducer<Any ?, NSError> in
296207 let executionSignal = RACSignal.`defer` {
297208 return self.execute(input)
298209 }
@@ -318,58 +229,24 @@ extension ActionProtocol {
318229/// - line: Current line in file.
319230///
320231/// - returns: Action created from `self`.
321- public func bridgedAction< Input> ( from command: RACCommand < Input > , file: String = #file, line: Int = #line) -> Action < AnyObject ? , AnyObject ? , NSError > {
232+ public func bridgedAction< Input> ( from command: RACCommand < Input > , file: String = #file, line: Int = #line) -> Action < Any ? , Any ? , NSError > {
322233 let command = command as! RACCommand < AnyObject >
323234 let enabledProperty = MutableProperty ( true )
324235
325236 enabledProperty <~ command. enabled. toSignalProducer ( )
326237 . map { $0 as! Bool }
327238 . flatMapError { _ in SignalProducer < Bool , NoError > ( value: false ) }
328239
329- return Action ( enabledIf: enabledProperty) { input -> SignalProducer < AnyObject ? , NSError > in
240+ return Action ( enabledIf: enabledProperty) { input -> SignalProducer < Any ? , NSError > in
330241 let executionSignal = RACSignal . `defer` {
331- return command. execute ( input)
242+ return command. execute ( input as AnyObject ? )
332243 }
333244
334245 return executionSignal. toSignalProducer ( file: file, line: line)
335246 }
336247}
337248
338- extension ActionProtocol where Input: AnyObject , Output: AnyObject {
339- /// Creates a RACCommand that will execute the action.
340- ///
341- /// - note: The returned command will not necessarily be marked as executing
342- /// when the action is. However, the reverse is always true: the Action
343- /// will always be marked as executing when the RACCommand is.
344- ///
345- /// - returns: `RACCommand` with bound action.
346- public func toRACCommand( ) -> RACCommand < Input > {
347- return RACCommand < Input > ( enabled: action. isCommandEnabled) { input -> RACSignal in
348- return self
349- . apply ( input!)
350- . toRACSignal ( )
351- }
352- }
353- }
354-
355- extension ActionProtocol where Input: OptionalProtocol , Input. Wrapped: AnyObject , Output: AnyObject {
356- /// Creates a RACCommand that will execute the action.
357- ///
358- /// - note: The returned command will not necessarily be marked as executing
359- /// when the action is. However, the reverse is always true: the Action
360- /// will always be marked as executing when the RACCommand is.
361- ///
362- /// - returns: `RACCommand` with bound action.
363- public func toRACCommand( ) -> RACCommand < Input . Wrapped > {
364- return RACCommand < Input . Wrapped > ( enabled: action. isCommandEnabled) { input -> RACSignal in
365- return self
366- . apply ( Input ( reconstructing: input) )
367- . toRACSignal ( )
368- }
369- }
370- }
371-
372- extension ActionProtocol where Input: AnyObject , Output: OptionalProtocol , Output. Wrapped: AnyObject {
249+ extension ActionProtocol where Input: AnyObject {
373250 /// Creates a RACCommand that will execute the action.
374251 ///
375252 /// - note: The returned command will not necessarily be marked as executing
@@ -386,7 +263,7 @@ extension ActionProtocol where Input: AnyObject, Output: OptionalProtocol, Outpu
386263 }
387264}
388265
389- extension ActionProtocol where Input: OptionalProtocol , Input. Wrapped: AnyObject , Output : OptionalProtocol , Output . Wrapped : AnyObject {
266+ extension ActionProtocol where Input: OptionalProtocol , Input. Wrapped: AnyObject {
390267 /// Creates a RACCommand that will execute the action.
391268 ///
392269 /// - note: The returned command will not necessarily be marked as executing
0 commit comments