ReactiveCocoa v4.2 发布
jopen 8年前
<p style="text-align: center;"><img alt="" src="https://simg.open-open.com/show/0c2c775693c57317553bf1880c4aeaea.png" /></p> <p>ReactiveCocoa的核心为signals即RACSignal类。Signals发出三种类型的事件流:next、completed、和error。</p> <p>通过此模式,ReactiveCocoa可以用来替代delegate、target-action、key-value observing等模式。</p> <p>通过signal API创建的代码更加统一且易读.但ReactiveCocoa真正强大之处在于通过这些信号源能进行更多高级操作.这些操作能在相当简洁高雅的操作下执行复杂的筛选、转换、信号协调等。在MVVM中,ReactiveCocoa扮演着重要角色.它提供ViewModel和View之间的绑定操作。</p> <h2>更新日志</h2> <h3>新增</h3> <ul> <li><code>ActionType</code> protocol for extending <code>Action</code>s (<a href="/misc/goto?guid=4958991154156739897">#2828</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a> and <a href="/misc/goto?guid=4958991154358458713">@cradnovich</a>!)</li> <li><code>Signal.sampleWith()</code>/<code>SignalProducer.sampleWith()</code>, which behaves like <code>sampleOn()</code> but includes the value from the sampler (<a href="/misc/goto?guid=4958991154446342034" title="Add sampleWith method">#2792</a>, thanks <a href="/misc/goto?guid=4958991154546057282">@victorlin</a>!)</li> <li><code>PropertyType.map()</code> for transforming properties (<a href="/misc/goto?guid=4958991154653529599" title="Add Property map operator">#2788</a>, thanks <a href="/misc/goto?guid=4958991154740110856">@sdduursma</a> and <a href="/misc/goto?guid=4958991154840804999">@filblue</a>!)</li> <li>A Swift playground demonstrating ReactiveCocoa (<a href="/misc/goto?guid=4958991154939389775" title="Swift Playground">#2795</a>, <a href="/misc/goto?guid=4958991155024254319">#2850</a>, <a href="/misc/goto?guid=4958991155125245899">#2930</a>, <a href="/misc/goto?guid=4958991155227837561">#2943</a>, thanks<a href="/misc/goto?guid=4958991155323514846">@RuiAAPeres</a>, <a href="/misc/goto?guid=4958991155425927754">@iv-mexx</a>, and <a href="/misc/goto?guid=4958991155511719252">@tomj</a>!)</li> <li><code>Signal.logEvents()</code>/<code>SignalProducer.logEvents()</code> for debugging (<a href="/misc/goto?guid=4958991155602818384">#2839</a>, <a href="/misc/goto?guid=4958991155704776544">#2895</a>, <a href="/misc/goto?guid=4958991155796475982">#2897</a>, thanks<a href="/misc/goto?guid=4958991155323514846">@RuiAAPeres</a> and <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> <li>Count- and predicate–based variants of <code>Signal.collect()</code> and <code>SignalProducer.collect()</code> (<a href="/misc/goto?guid=4958991155929765506">#2835</a>, thanks <a href="/misc/goto?guid=4958991156019424476">@dmcrodrigues</a>!)</li> <li>A convenience initializer to <code>CompositeDisposable</code> that takes a <code>SequenceType</code> of <code>Disposable?</code>s (<a href="/misc/goto?guid=4958991156106671367">#2806</a>, thanks <a href="/misc/goto?guid=4958991156209617901">@larryonoff</a>!)</li> <li><code>Signal.uniqueValues()</code>/<code>SignalProducer.uniqueValues()</code> (<a href="/misc/goto?guid=4958991156304437971">#2884</a>, thanks <a href="/misc/goto?guid=4958991156394708930">@mdiep</a> and<a href="/misc/goto?guid=4958991156492249879">@nixterrimus</a>!)</li> <li>Overloads for <code>flatMap()</code> and <code>flatten()</code> for <code>Signal</code>s and <code>SignalProducer</code>s with <code>NoError</code> (<a href="/misc/goto?guid=4958991156586458025">#2885</a>, thanks <a href="/misc/goto?guid=4958991156394708930">@mdiep</a>, <a href="/misc/goto?guid=4958991156698191257">@NachoSoto</a>, and <a href="/misc/goto?guid=4958879052618736669">@andymatuschak</a>!)</li> <li><code>+=</code> variant for CompositeDisposable and ActionDisposable (<a href="/misc/goto?guid=4958991156826581441">#2920</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> <li><code>SignalProducer.init(values: Value...)</code> (<a href="/misc/goto?guid=4958991156936218041">#2928</a>, thanks <a href="/misc/goto?guid=4958991156209617901">@larryonoff</a>!)</li> <li><code>SignalProducer.self.merge()</code> (<a href="/misc/goto?guid=4958991157029567874">#2925</a>, <a href="/misc/goto?guid=4958991157135896024">#2931</a>, thanks <a href="/misc/goto?guid=4958991156209617901">@larryonoff</a> and <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> <li><code>SignalProducer.prefix(value:)</code> and <code>SignalProducer.prefix()</code> for providing initial values (<a href="/misc/goto?guid=4958991157257920388">#2941</a><a href="/misc/goto?guid=4958991157347654346">#2954</a>, thanks <a href="/misc/goto?guid=4958991157439834676">@inamiy</a> and <a href="/misc/goto?guid=4958991155323514846">@RuiAAPeres</a>!)</li> <li><code>SignalProducer.concat(value:)</code> for concatenating a value (<a href="/misc/goto?guid=4958991157347654346">#2954</a>, thanks <a href="/misc/goto?guid=4958991155323514846">@RuiAAPeres</a>!)</li> </ul> <h3>改进</h3> <ul> <li><code>SignalProducer.replayLazily()</code> no longer uses <code>NSObject</code> (<a href="/misc/goto?guid=4958991157566686569">#2811</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> <li><code>NSNotificationCenter.rac_notifications()</code> will now interrupt if the object deallocates before the producer starts (<a href="/misc/goto?guid=4958991157675867376">#2859</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a> and <a href="/misc/goto?guid=4958879052618736669">@andymatuschak</a>!)</li> <li><code><~</code> will now automatically bridge values to Objective-C (<a href="/misc/goto?guid=4958991157792953124">#2551</a>, thanks <a href="/misc/goto?guid=4958991157890581622">@sharplet</a>!)</li> </ul> <h3>修复</h3> <ul> <li>Memory leak in <code>SignalProducer.lift()</code>, which is used internally in many operators (<a href="/misc/goto?guid=4958991157985113984">#2800</a>, thanks<a href="/misc/goto?guid=4958991154262794987">@ikesyo</a> and <a href="/misc/goto?guid=4958991158093927018">@trifonov-ivan</a>!)</li> <li>Recursive observation of <code>MutableProperty</code>s (<a href="/misc/goto?guid=4958991158188643990">#2764</a>, thanks <a href="/misc/goto?guid=4958991158278939411">@andersio</a> and <a href="/misc/goto?guid=4958991158376927235">@olegshnitko</a>!)</li> <li>Replace uses of spinlocks because they’re not safe on some devices (<a href="/misc/goto?guid=4958991158475205137">#2670</a>, thanks<a href="/misc/goto?guid=4958991158568335056">@Adlai-Holler</a>!)</li> <li>Potential deadlock in <code>SignalProducer.buffer()</code> (<a href="/misc/goto?guid=4958991158662160784">#2900</a>, thanks <a href="/misc/goto?guid=4958991156394708930">@mdiep</a>!)</li> <li><code>SignalProducer.replayLazily()</code> won’t interrupt while there are active subscriptions (<a href="/misc/goto?guid=4958991158767211447">#2903</a>, thanks<a href="/misc/goto?guid=4958991156394708930">@mdiep</a>!)</li> <li>Retain cycle with <code>Action.unsafeCocoaAction</code> (<a href="/misc/goto?guid=4958991158872524105">#2910</a>, thanks <a href="/misc/goto?guid=4958991156394708930">@mdiep</a>!)</li> <li><code>UIScheduler</code> now delivers events on the main queue (<a href="/misc/goto?guid=4958991158982546058">#2912</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> </ul> <h3>Objective-C</h3> <h3>新增</h3> <ul> <li><code>RACDelegateProxy</code> is now public (<a href="/misc/goto?guid=4958991159085869919">#2869</a>, thanks <a href="/misc/goto?guid=4958991156394708930">@mdiep</a>!)</li> </ul> <h3>改进</h3> <ul> <li><code>RACCommand</code> now specifies that its <code>InputType</code> is contravariant (<a href="/misc/goto?guid=4958991159200418134">#2696</a>, thanks <a href="/misc/goto?guid=4958991159290230234">@erichoracek</a>!)</li> </ul> <h3>修复</h3> <ul> <li>Behavior of <code>-[RACSequence foldRightWithStart:reduce:]</code> (<a href="/misc/goto?guid=4958991159380635675">#2777</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a>!)</li> <li>Memory leak in <code>-[UIControl rac_signalForControlEvents:]</code> (<a href="/misc/goto?guid=4958991159494053858">#2797</a>, thanks <a href="/misc/goto?guid=4958991159579455215">@vagase</a>!)</li> <li>Memory leak in <code>RACSubject</code> (<a href="/misc/goto?guid=4958991159685025278">#2845</a>, thanks <a href="/misc/goto?guid=4958991154262794987">@ikesyo</a> and <a href="/misc/goto?guid=4958991159799716899">@tzongw</a>!)</li> <li>Retaining of signals in <code>-[RACSignal bind:]</code>, which underpins most operators (<a href="/misc/goto?guid=4958991159897170566">#2935</a>, thanks<a href="/misc/goto?guid=4958991159799716899">@tzongw</a>!)</li> </ul> <h2>下载</h2> <ul> <li><a href="/misc/goto?guid=4958991159991115411" rel="nofollow">35 MB<strong>ReactiveCocoa.framework.zip</strong></a></li> <li><a href="/misc/goto?guid=4958991160094169404" rel="nofollow"><strong>Source code</strong> (zip)</a></li> <li><a href="/misc/goto?guid=4958991160190673126" rel="nofollow"><strong>Source code</strong> (tar.gz)</a></li> </ul> <p> </p>