{"id":6444,"date":"2023-01-11T12:50:36","date_gmt":"2023-01-11T04:50:36","guid":{"rendered":"https:\/\/1989lifejourney.com\/?p=6444"},"modified":"2023-02-04T16:13:58","modified_gmt":"2023-02-04T08:13:58","slug":"rxswift%e5%ad%b8%e7%bf%92%e9%87%8d%e9%bb%9e%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"https:\/\/1989lifejourney.com\/?p=6444","title":{"rendered":"RxSwift\u5b78\u7fd2\u91cd\u9ede\u6574\u7406"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">RxSwift\u5b78\u7fd2\u91cd\u9ede:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e0d\u53ef\u5fd8\u8a18\u7684\u524d\u63d0:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">\u4e8b\u4ef6\u662f\u5728\u54ea\u4e00\u689dthread\u4e0a\u57f7\u884c(ex: main thread or background thread)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u7269\u4ef6\u7684\u751f\u547d\u9031\u671f(i.e Observable\/Observer\u7684\u751f\u547d\u9031\u671f)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u6548\u80fd<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u4f7f\u7528\u7684\u8a18\u61b6\u9ad4\u63a7\u7ba1<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RxSwift\u597d\u8655:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">\u904b\u7528function programming\u65b9\u5f0f\uff0c\u89e3\u6c7acode\u904e\u65bc\u5206\u6563\u7b49\u554f\u984c\uff0c\u8b93\u7a0b\u5f0f\u78bc\u597d\u7dad\u8b77(p.s. RxSwift\u62ff\u53bb\u8ddfTarget-action\/Closure\/Delegate\u76f8\u6bd4)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u547c\u53ebupdate UI\u7684code\u6c38\u9060\u9700\u8981nested\u5728asynchronous action\u5167\u7684\u554f\u984c (p.s. KVO, Swift\u7684didSet\u4e5f\u6709\u89e3\u6c7a\u9019\u500b\u554f\u5716)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u89e3\u6c7aasynchronous action\u4e4b\u9593\u6709Dependency\u6642\uff0c\u90fd\u6703\u9700\u8981nested<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RxSwfit\u9054\u6210\u4e0a\u8ff0\u597d\u8655\u7684\u5be6\u4f5c\u6982\u5ff5:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">\u900f\u904e\u62bd\u8c61\u5316asynchronous action\uff0c\u5305\u6210function programming\u7684\u5f62\u5f0f\u8b93\u958b\u767c\u8005\u4f7f\u7528<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RxSwift\u6b63\u78ba\u7528\u6cd5\u7684\u62bd\u8c61\u6982\u5ff5:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">\u78ba\u4fdd\u300c\u8a02\u95b1\/\u8207\u8a02\u95b1\u7269\u4ef6\u7684\u751f\u547d\u9031\u671f\u300d\u80fd\u88ab\u9810\u671f(i.e. \u77e5\u9053\u4f55\u6642\u751f\u6210\/\u92b7\u6bc0)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u59a5\u5584\u904b\u7528compound operator(\u4f8b\u5982: combineLatest\/zip\u3001flatMap vs flatMapLatest\u3001distinctUntilChanged\u3001\u2026\u2026)\uff0c\u77e5\u9053\u5176\u5dee\u5225\u8207\u4f55\u6642\u4f7f\u7528<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5224\u65b7\u5de5\u7a0b\u5e2b\u5c0dRxSwift\u719f\u7df4\u7684\u7a0b\u5ea6:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">\u6703\u7528RxSwift\u5b8c\u6210\u529f\u80fd<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u6703\u5340\u5206RxSwift\u548cTarget-action\/Closure\/Delegate\u7684\u5dee\u5225<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u4e86\u89e3\u5982\u4f55\u59a5\u5584\u904b\u7528RxSwift\uff0c\u800c\u4e0d\u662f\u4e00\u4e9b\u53ef\u4ee5\u7528\u57fa\u672cdata structure(ex: Array\u3001Dictionary\u2026\u2026)\u7684\u5730\u65b9\uff0c\u4e5f\u4e0d\u81ea\u89ba\u5f97\u4f7f\u7528RxSwift<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u4e86\u89e3RxSwift\u6bd4\u8f03\u8907\u96dc\u7684operator\u4e14\u80fd\u8aaa\u51fa\u985e\u4f3coperator\u7684\u5dee\u5225\u8207\u4f55\u6642\u4f7f\u7528<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u6703\u7ba1\u63a7RxSwift\u7684\u8a02\u95b1\u751f\u547d\u9031\u671f\u8207Observable\u548cObserver\u662f\u5728\u54ea\u500bthread\u4e0a\u57f7\u884c<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u6709\u8fa6\u6cd5\u904b\u7528RxSwift\u9054\u6210MVVM architecture(p.s. \u9054\u6210Decouple UI\u548cViewModel\u3001UI\u548cViewModel\u548cService\u7684\u95dc\u4fc2)<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u80fd\u628a\u4e0a\u9762\u6574\u7406\u7684RxSwift\u91cd\u9ede\u81ea\u5df1\u8b1b\u51fa\u4f86\uff0c\u4e14\u300c\u80fd\u4e0a\u6a5f\u5be6\u4f5c\u51fa\u4f86\u300d<\/li>\n\n\n\n<li class=\"has-medium-font-size\">\u4e0d\u50c5\uff087\uff09\u80fd\u9054\u6210\uff0c\u4e5f\u6709\u61c9\u7528\u65bc\u5927\u578b\u7cfb\u7d71\u67b6\u69cb\u7684\u5be6\u52d9\u7d93\u9a57\uff08ex: \u4e00\u842c\u884ccode\u53ca\u80fd\u756b\u51faUML class diagrams\uff0c\u4e26\u8aaa\u660e\u904b\u7528RxSwift\u5f8c\uff0c\u9054\u6210\u4ec0\u9ebc\u4e8b\uff0c\u6709\u54ea\u4e9b\u5730\u65b9\/\u539f\u5247\u8981\u6ce8\u610f\uff09<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Backpressure feature of RxJava(p.s. RxSwift doesn&#8217;t have this feature)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/ReactiveX\/RxJava\/wiki\/Backpressure\">https:\/\/github.com\/ReactiveX\/RxJava\/wiki\/Backpressure<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Ref:<br><\/strong><a href=\"https:\/\/beeth0ven.github.io\/RxSwift-Chinese-Documentation\/\">https:\/\/beeth0ven.github.io\/RxSwift-Chinese-Documentation\/<br><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RxSwift\u5b78\u7fd2\u91cd\u9ede: \u4e0d\u53ef\u5fd8\u8a18\u7684\u524d\u63d0: RxSwift\u597d\u8655: RxSwfit\u9054\u6210\u4e0a\u8ff0\u597d\u8655\u7684\u5be6\u4f5c\u6982\u5ff5: Rx [&hellip;]<\/p>\n","protected":false},"author":139426785,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_postgate_lock_override":"inherit","_postgate_lock_mode":"inherit","_postgate_preview_mode":"inherit","_postgate_preview_limit":0,"_postgate_product_ids":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[37324612,373736456,596263,1],"tags":[],"post_folder":[],"class_list":["post-6444","post","type-post","status-publish","format-standard","hentry","category-ios-development","category-rxswift","category-swift","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paR5vw-1FW","jetpack-related-posts":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/6444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/users\/139426785"}],"replies":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6444"}],"version-history":[{"count":7,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/6444\/revisions"}],"predecessor-version":[{"id":6570,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/6444\/revisions\/6570"}],"wp:attachment":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6444"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fpost_folder&post=6444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}