ReactiveCocoa v4.2 發布

ReactiveCocoa的核心為signals即RACSignal類。Signals發出三種類型的事件流:next、completed、和error。
通過此模式,ReactiveCocoa可以用來替代delegate、target-action、key-value observing等模式。
通過signal API創建的代碼更加統一且易讀.但ReactiveCocoa真正強大之處在于通過這些信號源能進行更多高級操作.這些操作能在相當簡潔高雅的操作下執行復雜的篩選、轉換、信號協調等。在MVVM中,ReactiveCocoa扮演著重要角色.它提供ViewModel和View之間的綁定操作。
更新日志
新增
ActionTypeprotocol for extendingActions (#2828, thanks @ikesyo and @cradnovich!)Signal.sampleWith()/SignalProducer.sampleWith(), which behaves likesampleOn()but includes the value from the sampler (#2792, thanks @victorlin!)PropertyType.map()for transforming properties (#2788, thanks @sdduursma and @filblue!)- A Swift playground demonstrating ReactiveCocoa (#2795, #2850, #2930, #2943, thanks@RuiAAPeres, @iv-mexx, and @tomj!)
Signal.logEvents()/SignalProducer.logEvents()for debugging (#2839, #2895, #2897, thanks@RuiAAPeres and @ikesyo!)- Count- and predicate–based variants of
Signal.collect()andSignalProducer.collect()(#2835, thanks @dmcrodrigues!) - A convenience initializer to
CompositeDisposablethat takes aSequenceTypeofDisposable?s (#2806, thanks @larryonoff!) Signal.uniqueValues()/SignalProducer.uniqueValues()(#2884, thanks @mdiep and@nixterrimus!)- Overloads for
flatMap()andflatten()forSignals andSignalProducers withNoError(#2885, thanks @mdiep, @NachoSoto, and @andymatuschak!) +=variant for CompositeDisposable and ActionDisposable (#2920, thanks @ikesyo!)SignalProducer.init(values: Value...)(#2928, thanks @larryonoff!)SignalProducer.self.merge()(#2925, #2931, thanks @larryonoff and @ikesyo!)SignalProducer.prefix(value:)andSignalProducer.prefix()for providing initial values (#2941#2954, thanks @inamiy and @RuiAAPeres!)SignalProducer.concat(value:)for concatenating a value (#2954, thanks @RuiAAPeres!)
改進
SignalProducer.replayLazily()no longer usesNSObject(#2811, thanks @ikesyo!)NSNotificationCenter.rac_notifications()will now interrupt if the object deallocates before the producer starts (#2859, thanks @ikesyo and @andymatuschak!)<~will now automatically bridge values to Objective-C (#2551, thanks @sharplet!)
修復
- Memory leak in
SignalProducer.lift(), which is used internally in many operators (#2800, thanks@ikesyo and @trifonov-ivan!) - Recursive observation of
MutablePropertys (#2764, thanks @andersio and @olegshnitko!) - Replace uses of spinlocks because they’re not safe on some devices (#2670, thanks@Adlai-Holler!)
- Potential deadlock in
SignalProducer.buffer()(#2900, thanks @mdiep!) SignalProducer.replayLazily()won’t interrupt while there are active subscriptions (#2903, thanks@mdiep!)- Retain cycle with
Action.unsafeCocoaAction(#2910, thanks @mdiep!) UISchedulernow delivers events on the main queue (#2912, thanks @ikesyo!)
Objective-C
新增
改進
RACCommandnow specifies that itsInputTypeis contravariant (#2696, thanks @erichoracek!)
修復
- Behavior of
-[RACSequence foldRightWithStart:reduce:](#2777, thanks @ikesyo!) - Memory leak in
-[UIControl rac_signalForControlEvents:](#2797, thanks @vagase!) - Memory leak in
RACSubject(#2845, thanks @ikesyo and @tzongw!) - Retaining of signals in
-[RACSignal bind:], which underpins most operators (#2935, thanks@tzongw!)
下載
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!