{"id":17416,"date":"2017-03-14T16:49:46","date_gmt":"2017-03-14T20:49:46","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=17416"},"modified":"2017-03-14T16:49:46","modified_gmt":"2017-03-14T20:49:46","slug":"rxnot","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2017\/03\/14\/rxnot\/","title":{"rendered":"RxNot"},"content":{"rendered":"<p><a href=\"http:\/\/subfurther.com\/blog\/2017\/03\/13\/rxnot\/\">Chris Adamson<\/a>:<\/p>\n<blockquote cite=\"http:\/\/subfurther.com\/blog\/2017\/03\/13\/rxnot\/\">\n<p>It&rsquo;s not like iOS isn&rsquo;t meant to deal with asynchronous events. In fact, it has lots of different techniques&#8230; all mutually incompatible, owing to the long development of the Cocoa and Cocoa Touch APIs over the years, and the legacy of Objective-C.<\/p>\n<p>[&#8230;]<\/p>\n<p>So now let&rsquo;s look at how ReactiveX deals with this. In Rx, things that change over time are offered as <a href=\"http:\/\/reactivex.io\/documentation\/observable.html\">observables<\/a>. [&#8230;] So, where&rsquo;s the rub? For starters, it takes a long time to get the hang of Rx, both to get into its mindset (it sucks when you just need to get the current value of something, but it&rsquo;s an observable, so there&rsquo;s no real concept of a &ldquo;current&rdquo; value). And then there are all the operators. Follow that link to the <a href=\"http:\/\/reactivex.io\/documentation\/operators.html\">operators<\/a> that I linked a few paragraphs back. There are over 70 of them.<\/p>\n<p>[&#8230;]<\/p>\n<p>In practice, there are lots of ways to mess this up. Are you right to only want one event? What if you forget to capture <code>self<\/code> weakly? The worse problem is when your closure is never called: setting breakpoints in this code will do nothing, so it&rsquo;s a hair-pulling exercise to figure out if <code>fooObservable<\/code> is not producing events, or if your chain is screwing them up somehow.<\/p>\n<p>[&#8230;]<\/p>\n<p>In my experience, Rx turns out to be far more costly than it would originally appear from the propaganda. I can&rsquo;t speak for my ex-employer of course, but my own takeaway is that 1) adopting Rx can take <em>way<\/em> longer than you&rsquo;d expect, 2) RxSwift seems to really slow down the Swift compiler (possibly because of having to do a bunch of type inference through those chains of Rx operators).<\/p>\n<\/blockquote>\n\n<p><a href=\"http:\/\/subfurther.com\/blog\/2017\/03\/13\/rxnot\/#comment-18034\">Mark Lilback<\/a>:<\/p>\n<blockquote cite=\"http:\/\/subfurther.com\/blog\/2017\/03\/13\/rxnot\/#comment-18034\"><p>I don&rsquo;t buy the idea of replacing everything with it. But use the right tool for the right job. For chained operations it is better than promises\/futures and much better than callbacks\/closures.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Chris Adamson: It&rsquo;s not like iOS isn&rsquo;t meant to deal with asynchronous events. In fact, it has lots of different techniques&#8230; all mutually incompatible, owing to the long development of the Cocoa and Cocoa Touch APIs over the years, and the legacy of Objective-C. [&#8230;] So now let&rsquo;s look at how ReactiveX deals with this. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[31,1380,71,341,901],"class_list":["post-17416","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-10","tag-programming","tag-reactivecocoa","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=17416"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17416\/revisions"}],"predecessor-version":[{"id":17417,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17416\/revisions\/17417"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=17416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=17416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=17416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}