{"id":344369,"date":"2023-01-24T09:00:56","date_gmt":"2023-01-24T09:00:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344369"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344369","title":{"rendered":"<span>Combine: \u0447\u0430\u0441\u0442\u044c 1. \u041f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439, \u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 SimbirSoft.<\/p>\n<p>\u0423\u0436\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b 2023 \u0433\u043e\u0434, \u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043d\u0435 \u0443\u0442\u0438\u0445\u0430\u044e\u0442. \u041d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0438, \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0435\u0439\u0448\u043d-\u0446\u0435\u043d\u0442\u0440\u044b \u0441 \u00ab\u0431\u043e\u0440\u043e\u0434\u0430\u0442\u044b\u043c\u0438\u00bb Objective-C-\u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u043d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e Apple \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043c\u043e\u0434\u043d\u044b\u0439 Swift Concurrency.<\/p>\n<p>Combine \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u0417\u0430 \u0441\u0447\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f\u00a0\u0443 \u043d\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u00ab\u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0442\u044c\u00bb \u043a\u0430\u043a \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043b\u0435\u0433\u0430\u0441\u0438-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0442\u0430\u043a \u0438 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u2014 SwiftUI \u0438\u043b\u0438 async\/await.<\/p>\n<p>\u041f\u0435\u0441\u0442\u0440\u044b\u0439 \u00ab\u0437\u043e\u043e\u043f\u0430\u0440\u043a\u00bb \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f: \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043c\u043d\u043e\u0433\u043e\u043b\u0435\u0442\u043d\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439?<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Combine \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043e \u043d\u0435\u043c \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>\u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0433\u0434\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 Combine, \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0435\u0433\u043e \u0441 RxSwift. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u043e\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0441\u043f\u0435\u043b \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a01\/f66\/47b\/a01f6647b2cda6fafb715331523de318.png\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a01\/f66\/47b\/a01f6647b2cda6fafb715331523de318.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0418\u0434\u0435\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u2014 \u0432 2009 \u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Microsoft \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Reactive Extensions \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u0430 .NET (<u>rx.NET<\/u>). \u0412 2012 \u0433\u043e\u0434\u0443 \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432\u044b\u043b\u043e\u0436\u0438\u043b\u0438 \u0432 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445: RxJS, RxKotlin, RxPHP \u0438 \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<p>Swift \u043d\u0435 \u0441\u0442\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c\u00a0RxSwift, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0442 Apple \u2014 <strong>Combine<\/strong>.\u00a0<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p><strong>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong> \u2014\u00a0\u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u0438 \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0412 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u0435\u0436\u0438\u0442\u00a0\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00a0<strong>Observer\u00a0<\/strong>\u2014 \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043d\u0435\u0433\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 2 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 (Publisher)<\/strong> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0449\u0438\u0439 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435, \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a (Subscriber) <\/strong>\u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0438 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 (\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b, \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435), \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u00a0<\/p>\n<p><strong>\u041f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0434\u0443\u0442 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u043a \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e @escaping closure,\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043f\u043e\u0440\u0446\u0438\u043e\u043d\u043d\u043e, \u0430 \u043d\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<p><strong>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/strong> \u2014 \u044d\u0442\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041f\u043e\u0434 <strong>\u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c, \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0435\u0445 \u0432\u0438\u0434\u043e\u0432: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0Bool, String, \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435), \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0435\u0442.<\/p>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e:<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u043b\u043e\u0433\u0435\u0440 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 (\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0435\u0434\u044f\u0442 \u0437\u0430 \u0435\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438 \u0438 \u043a\u0430\u043a-\u0442\u043e \u043d\u0430 \u043d\u0438\u0445 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u044e\u0442 (\u043b\u0430\u0439\u043a\u0430\u044e\u0442, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0438\u043b\u0438 \u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u0445\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0437\u0430 \u043e\u0441\u043a\u043e\u0440\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442).<\/p>\n<p>\u0411\u043b\u043e\u0433\u0435\u0440 \u2014 \u044d\u0442\u043e <strong>Publisher<\/strong>. \u041e\u043d \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e \u0434\u0432\u0435).<\/p>\n<p>\u0415\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e <strong>Values\u00a0<\/strong>\u0438 <strong>Error<\/strong>. \u0422\u0435 \u0441\u0430\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0432\u0447\u0435\u0440\u0430 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043e\u0434\u043d\u0443 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0434\u0440\u0443\u0433\u0443\u044e).<\/p>\n<p>\u0415\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u2014 \u044d\u0442\u043e <strong>Subscribers<\/strong>. \u041e\u043d\u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 (\u00ab\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u00bb) \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0431\u043b\u043e\u0433\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f (\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 <strong>Values<\/strong>), \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043b\u0430\u0439\u043a\u0438, \u0430 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u043b \u043c\u043e\u0434\u0435\u0440\u0430\u0446\u0438\u044e (\u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u2014 <strong>Error<\/strong>), \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u043d\u0435 \u0443\u0432\u0438\u0434\u044f\u0442 \u043e\u0441\u043a\u043e\u0440\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0441\u0435\u0442\u044c \u0431\u0430\u043d\u043d\u0435\u0440 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <strong>Publisher <\/strong>\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/067\/0b1\/e70\/0670b1e70ab5365edd605e1a6abce2bf.png\" width=\"1120\" height=\"248\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/067\/0b1\/e70\/0670b1e70ab5365edd605e1a6abce2bf.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041e\u0442\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c<\/h2>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e-\u043d\u043e\u0432\u043e\u043c\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043e\u0442\u043b\u0438\u0447\u0438\u0439:<\/p>\n<p>1) <strong>push<\/strong>\u00a0\u0432\u043c\u0435\u0441\u0442\u043e <strong>pull<\/strong><\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u043b\u0438 UserDefaults), \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u0430\u0441\u0441\u0438\u0432 (\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441) \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u043d\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<p>2)\u00a0<strong>auto update<\/strong><\/p>\n<p>\u0412 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>\u0421\u043c\u0435\u043d\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0442\u0430\u0431\u0435, \u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u044b \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0435\u0441\u043b\u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u00ab\u043f\u0440\u043e\u0442\u0443\u0445\u043d\u0435\u0442\u00bb \u0442\u043e\u043a\u0435\u043d. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>\u0412 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u044f \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u043c, \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0443\u0441 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u043c\u044b \u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0435\u0433\u043e \u0438 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430\u0447\u0430\u0432 \u0437\u0430\u043d\u043e\u0432\u043e \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043e\u0441\u043b\u0438\u043a\u0430 \u0438\u0437 \u0428\u0440\u0435\u043a\u0430: \u00ab\u0410 \u0441\u0435\u0439\u0447\u0430\u0441? \u0423\u0436\u0435 \u043c\u043e\u0436\u043d\u043e? \u041c\u043e\u0436\u0435\u0442, \u043f\u043e\u0440\u0430?\u00bb.<\/p>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043c\u044b \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0438 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"swift\">class AuthorizationService {      private enum Constants {         static let key = \"anyKey\"     }      private let subject = CurrentValueSubject&lt;Bool, Never>(         UserDefaults.standard.bool(forKey: Constants.key)     )      var isUserLoggedIn: Bool {         subject.value     }      var isUserLoggedInPublisher: AnyPublisher&lt;Bool, Never> {         subject             .receive(on: DispatchQueue.main)             .eraseToAnyPublisher()     }      func logout() {         subject.send(false)         UserDefaults.standard.setValue(false, forKey: Constants.key)     } }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0437 \u043c\u0438\u0440\u0430 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 MRC \u043a ARC \u2014 \u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c\u00a0\u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b retain \/ release.<\/p>\n<p>3) <strong>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c<\/strong><\/p>\n<p>\u0412\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c.<\/p>\n<p>\u0418\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<pre><code class=\"swift\">private func fetchData(from url: URL, completion: @escaping ([User]) -> Void) {         let dataTask = URLSession.shared.dataTask(with: url) { data, _, error in             if let _ = error {                 completion([])             }             guard let data = data else {                 return completion([])             }                          do {                 let decoder = JSONDecoder()                 let users = try decoder.decode([User].self, from: data)                 DispatchQueue.main.async {                     completion(users)                 }             } catch {                 completion([])             }         }         dataTask.resume()     }<\/code><\/pre>\n<p>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<pre><code class=\"swift\">private func fetchData(from url: URL) -> AnyPublisher&lt;[User], Never> {         URLSession.shared.dataTaskPublisher(for: url)             .map { $0.data }             .decode(type: [User].self, decoder: JSONDecoder())             .receive(on: DispatchQueue.main)             .replaceError(with: [])             .eraseToAnyPublisher()     }<\/code><\/pre>\n<p><strong>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>\u041f\u043b\u044e\u0441\u044b<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041c\u0438\u043d\u0443\u0441\u044b<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043b\u043e\u0436\u043d\u043e \u00ab\u0432\u044a\u0435\u0445\u0430\u0442\u044c\u00bb \u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0427\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0435\u0448\u0435\u0432\u0438\u0437\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0435\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437-\u0437\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 \u043d\u0430\u0439\u043c\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e \u0437\u043d\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 (\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0434\u0435\u0442\u0438\u0449\u0435)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 iOS<\/h2>\n<p>\u0412 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435, \u043d\u043e \u0444\u0430\u0432\u043e\u0440\u0438\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430: RxSwift \u0438 Combine.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/23a\/ba5\/d0d\/23aba5d0dce4fe6cb04b8cbff048721b.png\" width=\"1188\" height=\"660\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/23a\/ba5\/d0d\/23aba5d0dce4fe6cb04b8cbff048721b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>RxSwift \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435 Combine \u043d\u0430 4 \u0433\u043e\u0434\u0430. \u041e\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u043f\u043e \u043d\u0435\u043c\u0443 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0438 \u043d\u0430 Stackoverflow.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 RxSwift \u2014 \u043e\u0431\u0432\u044f\u0437\u043a\u0438 \u0441 UIKit. \u041d\u0430\u043c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0432 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"swift\">let button = UIButton()  button.rx.tap.bind { \u00a0 \u00a0 \/\/ handle tap }<\/code><\/pre>\n<p>\u0412 Combine \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443, \u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u043e\u0442\u0435\u043d \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438\u00a0\u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d Apple \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043d\u043e\u0432\u044b\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u2014 SwiftUI.<\/p>\n<pre><code class=\"swift\">let button = UIButton()  button.publisher(for: .touchUpInside) \u00a0 \u00a0 .sink { \u00a0 \u00a0 \u00a0 \u00a0 \/\/ handle tap }<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0447\u0435\u0440\u0442\u0443, \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0443 \u043e\u0431\u043e\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430 \u0438 \u043f\u0440\u043e\u0442\u0438\u0432. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0432\u044f\u0437\u043e\u043a \u0441 UIkit \u043d\u0430 Combine\u00a0\u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a, \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/github.com\/CombineCommunity\/rxswift-to-combine-cheatsheet\"><u>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438\u00a0Combine \u0438 RxSwift<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ReactiveX\/RxSwift\"><u>\u0414\u043e\u043a\u0430 \u043f\u043e Rx<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/combine\"><u>\u0414\u043e\u043a\u0430 \u043f\u043e Combine<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.swiftbysundell.com\/articles\/building-custom-combine-publishers-in-swift\/\"><u>\u041e\u0431\u0432\u044f\u0437\u043a\u0438 \u043d\u0430 Combine<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/gist.github.com\/d-date\/735fa126e37ed88ff9d0011f6dc0510b\"><u>Gist<\/u><\/a><\/p>\n<\/li>\n<\/ol>\n<h2>Hello, Combine<\/h2>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438, \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438, push-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0441\u043c\u0435\u043d\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u0437\u0432\u043e\u043d\u043a\u0435 \u0438\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0448\u0442\u043e\u0440\u043a\u0438 \u0441 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u0442\u0438\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b (delegate pattern).<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (@escaping closures).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438 (observer pattern):<\/p>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<p>Notification Center;<\/p>\n<\/li>\n<li>\n<p>KVO;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c target-action.<\/p>\n<\/li>\n<\/ul>\n<p>Combine \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0434\u0438\u043d\u044b\u0439 API \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435. \u041c\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\u00a0\u043a\u0430\u043a URLSession + Notification Center. \u0418 \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0441\u0442\u044b\u043b\u044c \u0438\u043b\u0438 \u0442\u0430\u0449\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c. \u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e Combine \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439\u00a0\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Combine, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0440\u0435\u043c\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438: \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430\u043c\u0438, \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p><strong>Publisher<\/strong><\/p>\n<p><strong>Publisher <\/strong>\u2014 \u044d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439\u00a0\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0439 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 Publisher, \u0441 \u0434\u0432\u0443\u043c\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438: Output \u0438 Failure.<\/p>\n<p><strong>Output\u00a0<\/strong>\u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0442\u0438\u043f\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0String).<\/p>\n<p><strong>Failure <\/strong>\u2014 \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0443\u0445 \u0442\u0438\u043f\u043e\u0432: Error \u0438 Never, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.<\/p>\n<pre><code class=\"swift\">public protocol Publisher&lt;Output, Failure> { \u00a0 \u00a0 associatedtype Output \u00a0 \u00a0 associatedtype Failure : Error }<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1c0\/fa6\/92d\/1c0fa692da6ee446dc5df0036e4bedd4.png\" width=\"280\" height=\"240\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c0\/fa6\/92d\/1c0fa692da6ee446dc5df0036e4bedd4.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"swift\">let array = [\"value1\", \"value2\", \"value3\"] let sequencePublisher = array.publisher<\/code><\/pre>\n<p>\u041c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a. \u041f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430, \u0432\u0435\u0434\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0434\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 (\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430), \u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a.<\/p>\n<p><strong>Subscriber<\/strong><\/p>\n<p><strong>Subscriber<\/strong>\u00a0\u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a. \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u00a0\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u0441 \u0434\u0432\u0443\u043c\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438: Input \u0438 Failure.<\/p>\n<p><strong>Input <\/strong>\u2014 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p><strong>Failure<\/strong> \u2014 \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430.<\/p>\n<pre><code class=\"swift\">public protocol Subscriber&lt;Input, Failure> : CustomCombineIdentifierConvertible { \u00a0 \u00a0 associatedtype Input \u00a0 \u00a0 associatedtype Failure : Error }<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/670\/d5e\/393\/670d5e39348d8920b9e85a467a82c31f.png\" width=\"280\" height=\"240\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/670\/d5e\/393\/670d5e39348d8920b9e85a467a82c31f.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"swift\">let array = [\"value1\", \"value2\", \"value3\"] let sequencePublisher = array.publisher  sequencePublisher     .sink { receivedValue in         print(receivedValue)     }<\/code><\/pre>\n<p>.sink \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0435\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"swift\">func sink(receiveValue: @escaping ((Self.Output) -> Void)) -> AnyCancellable<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e @escaping closure, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0441 \u0442\u0438\u043f\u043e\u043c AnyCancellable. \u0427\u0442\u043e \u044d\u0442\u043e \u0438 \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u043e \u043d\u0430\u0434\u043e?<\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440, \u044d\u0442\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430\u0434\u043e \u0433\u0434\u0435-\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u0417\u0430\u0447\u0435\u043c? <\/p>\n<ol>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u043e\u0442\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u00ab\u0436\u0438\u043b\u00bb \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0433\u0434\u0435 \u043e\u043d \u0431\u044b\u043b \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d, \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0433 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 viewDidLoad \u0438 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438\u00a0\u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0441 \u0442\u0438\u043f\u043e\u043c AnyCancellable. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 .store(in:), \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u043d\u0430\u043a\u0430 =<\/p>\n<pre><code class=\"swift\">var cancellable: [AnyCancellable] = []  \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e .store(in: ) sequencePublisher     .sink { receivedValue in         print(receivedValue)     }     .store(in: &amp;cancellable) \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e = var cancellable = sequencePublisher     .sink { receivedValue in         print(receivedValue)     }<\/code><\/pre>\n<p><strong>Publisher + Subscriber<\/strong><\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445\u00a0\u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u2014 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a. \u041d\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0438\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b\u00a0Output \u2014 Input \u0438 Failure.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6a1\/4e4\/d74\/6a14e4d7441f080603cb128238ae30b2.png\" width=\"650\" height=\"336\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6a1\/4e4\/d74\/6a14e4d7441f080603cb128238ae30b2.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0440\u0435\u0442\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a\u043e\u043c\u0431\u0430\u0439\u043d\u0430 \u2014 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<p><strong>Operator<\/strong><\/p>\n<p><strong>Operator <\/strong>\u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8d1\/6be\/de1\/8d16bede1ca603ca04048d97d2f521ae.png\" width=\"160\" height=\"398\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8d1\/6be\/de1\/8d16bede1ca603ca04048d97d2f521ae.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"swift\">func map&lt;T>(_ transform: (Elements.Element) -> T) -> Publishers.Sequence&lt;[T], Failure><\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 .map(), \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u2014 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440, \u043d\u043e \u0441 \u043e\u0434\u043d\u0438\u043c \u0432\u0430\u0436\u043d\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c: \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430-\u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u0430. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.<\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u043d\u0438 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u00ab\u043c\u043e\u0441\u0442\u0438\u043a\u0430\u00bb \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u043e\u043c \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u043c. \u0418\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043e\u0442\u0434\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u043e\u0442\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 Int, \u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430 String, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 .map() \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0442\u0438\u043f.<\/p>\n<pre><code class=\"swift\">var cancellable: [AnyCancellable] = [] let arrayPublisher = [1, 2, 3].publisher arrayPublisher     .map { initialValue in         String(initialValue)     }     .sink { transformedValue in         print(transformedValue)     }     .store(in: &amp;cancellable)<\/code><\/pre>\n<p>\u041e\u0431\u0449\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u043e\u0432, \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:\u00a0 <\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440), \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 (\u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a), \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435\u00a0\u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u0412\u0441\u044f \u044d\u0442\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c Data stream.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2a4\/6e8\/0ea\/2a46e80ea827cab06b04f1d6919c527c.png\" width=\"560\" height=\"158\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2a4\/6e8\/0ea\/2a46e80ea827cab06b04f1d6919c527c.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u044b\u0432\u043e\u0434<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 Combine.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f Combine \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043e\u043b\u043e\u0434\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 iOS 13. \u0415\u0441\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RxSwift.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u0438\u0434\u044b \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u043e\u0432 \u0438 \u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<p><strong>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/strong><\/p>\n<p><strong>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0432 \u043d\u0430\u0448\u0438\u0445 \u0441\u043e\u0446\u0441\u0435\u0442\u044f\u0445 \u2013\u00a0<\/strong><a href=\"https:\/\/vk.com\/simbirsoft\"><strong><u>\u0412\u041a<\/u><\/strong><\/a><strong>\u00a0\u0438\u00a0<\/strong><a href=\"https:\/\/t.me\/simbirsoft_dev\"><strong><u>Telegram<\/u><\/strong><\/a><strong>.<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/712332\/\"> https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/712332\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439, \u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 SimbirSoft.<\/p>\n<p>\u0423\u0436\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b 2023 \u0433\u043e\u0434, \u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043d\u0435 \u0443\u0442\u0438\u0445\u0430\u044e\u0442. \u041d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0438, \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0435\u0439\u0448\u043d-\u0446\u0435\u043d\u0442\u0440\u044b \u0441 \u00ab\u0431\u043e\u0440\u043e\u0434\u0430\u0442\u044b\u043c\u0438\u00bb Objective-C-\u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u043d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e Apple \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043c\u043e\u0434\u043d\u044b\u0439 Swift Concurrency.<\/p>\n<p>Combine \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u0417\u0430 \u0441\u0447\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f\u00a0\u0443 \u043d\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u00ab\u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0442\u044c\u00bb \u043a\u0430\u043a \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043b\u0435\u0433\u0430\u0441\u0438-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0442\u0430\u043a \u0438 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u2014 SwiftUI \u0438\u043b\u0438 async\/await.<\/p>\n<p>\u041f\u0435\u0441\u0442\u0440\u044b\u0439 \u00ab\u0437\u043e\u043e\u043f\u0430\u0440\u043a\u00bb \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f: \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043c\u043d\u043e\u0433\u043e\u043b\u0435\u0442\u043d\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439?<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Combine \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043e \u043d\u0435\u043c \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>\u042d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0433\u0434\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 Combine, \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0435\u0433\u043e \u0441 RxSwift. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u043e\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0441\u043f\u0435\u043b \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0418\u0434\u0435\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u2014 \u0432 2009 \u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Microsoft \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Reactive Extensions \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u0430 .NET (<u>rx.NET<\/u>). \u0412 2012 \u0433\u043e\u0434\u0443 \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432\u044b\u043b\u043e\u0436\u0438\u043b\u0438 \u0432 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445: RxJS, RxKotlin, RxPHP \u0438 \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<p>Swift \u043d\u0435 \u0441\u0442\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c\u00a0RxSwift, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0442 Apple \u2014 <strong>Combine<\/strong>.\u00a0<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p><strong>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong> \u2014\u00a0\u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u0438 \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0412 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u0435\u0436\u0438\u0442\u00a0\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00a0<strong>Observer\u00a0<\/strong>\u2014 \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043d\u0435\u0433\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 2 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 (Publisher)<\/strong> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0449\u0438\u0439 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435, \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a (Subscriber) <\/strong>\u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u0438 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 (\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b, \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435), \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u00a0<\/p>\n<p><strong>\u041f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0434\u0443\u0442 \u043e\u0442 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440\u0430 \u043a \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e @escaping closure,\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043f\u043e\u0440\u0446\u0438\u043e\u043d\u043d\u043e, \u0430 \u043d\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<p><strong>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/strong> \u2014 \u044d\u0442\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041f\u043e\u0434 <strong>\u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c, \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0435\u0445 \u0432\u0438\u0434\u043e\u0432: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0Bool, String, \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435), \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0430\u0431\u043b\u0438\u0448\u0435\u0440 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0435\u0442.<\/p>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e:<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u043b\u043e\u0433\u0435\u0440 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 (\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0435\u0434\u044f\u0442 \u0437\u0430 \u0435\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438 \u0438 \u043a\u0430\u043a-\u0442\u043e \u043d\u0430 \u043d\u0438\u0445 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u044e\u0442 (\u043b\u0430\u0439\u043a\u0430\u044e\u0442, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0438\u043b\u0438 \u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u0445\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0437\u0430 \u043e\u0441\u043a\u043e\u0440\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442).<\/p>\n<p>\u0411\u043b\u043e\u0433\u0435\u0440 \u2014 \u044d\u0442\u043e <strong>Publisher<\/strong>. \u041e\u043d \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e \u0434\u0432\u0435).<\/p>\n<p>\u0415\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e <strong>Values\u00a0<\/strong>\u0438 <strong>Error<\/strong>. \u0422\u0435 \u0441\u0430\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0432\u0447\u0435\u0440\u0430 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043e\u0434\u043d\u0443 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0434\u0440\u0443\u0433\u0443\u044e).<\/p>\n<p>\u0415\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u2014 \u044d\u0442\u043e <strong>Subscribers<\/strong>. \u041e\u043d\u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 (\u00ab\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u00bb) \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0431\u043b\u043e\u0433\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f (\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 <strong>Values<\/strong>), \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043b\u0430\u0439\u043a\u0438, \u0430 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u043b \u043c\u043e\u0434\u0435\u0440\u0430\u0446\u0438\u044e (\u043e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u2014 <strong>Error<\/strong>), \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438 \u043d\u0435 \u0443\u0432\u0438\u0434\u044f\u0442 \u043e\u0441\u043a\u043e\u0440\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0441\u0435\u0442\u044c \u0431\u0430\u043d\u043d\u0435\u0440 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <strong>Publisher <\/strong>\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041e\u0442\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c<\/h2>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e-\u043d\u043e\u0432\u043e\u043c\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043e\u0442\u043b\u0438\u0447\u0438\u0439:<\/p>\n<p>1) <strong>push<\/strong>\u00a0\u0432\u043c\u0435\u0441\u0442\u043e <strong>pull<\/strong><\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u043b\u0438 UserDefaults), \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u0430\u0441\u0441\u0438\u0432 (\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441) \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u043d\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<p>2)\u00a0<strong>auto update<\/strong><\/p>\n<p>\u0412 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>\u0421\u043c\u0435\u043d\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0442\u0430\u0431\u0435, \u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u044b \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0435\u0441\u043b\u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u00ab\u043f\u0440\u043e\u0442\u0443\u0445\u043d\u0435\u0442\u00bb \u0442\u043e\u043a\u0435\u043d. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>\u0412 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u044f \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u043c, \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0443\u0441 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u043c\u044b \u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0435\u0433\u043e \u0438 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430\u0447\u0430\u0432 \u0437\u0430\u043d\u043e\u0432\u043e \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043e\u0441\u043b\u0438\u043a\u0430 \u0438\u0437 \u0428\u0440\u0435\u043a\u0430: \u00ab\u0410 \u0441\u0435\u0439\u0447\u0430\u0441? \u0423\u0436\u0435 \u043c\u043e\u0436\u043d\u043e? \u041c\u043e\u0436\u0435\u0442, \u043f\u043e\u0440\u0430?\u00bb.<\/p>\n<p>\u0412 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043c\u044b \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0438 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"swift\">class AuthorizationService {      private enum Constants {         static let key = \"anyKey\"     }      private let subject = CurrentValueSubject&lt;Bool, Never>(         UserDefaults.standard.bool(forKey: Constants.key)     )      var isUserLoggedIn: Bool {         subject.value     }      var isUserLoggedInPublisher: AnyPublisher&lt;Bool, Never> {         subject             .receive(on: DispatchQueue.main)             .eraseToAnyPublisher()     }      func logout() {         subject.send(false)         UserDefaults.standard.setValue(false, forKey: Constants.key)     } }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0437 \u043c\u0438\u0440\u0430 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 MRC \u043a ARC \u2014 \u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c\u00a0\u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b retain \/ release.<\/p>\n<p>3) <strong>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c<\/strong><\/p>\n<p>\u0412\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c.<\/p>\n<p>\u0418\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<pre><code class=\"swift\">private func fetchData(from url: URL, completion: @escaping ([User]) -> Void) {         let dataTask = URLSession.shared.dataTask(with: url) { data, _, error in             if let _ = error {                 completion([])             }             guard let data = data else {                 return completion([])             }                          do {                 let decoder = JSONDecoder()                 let users = try decoder.decode([User].self, from: data)                 DispatchQueue.main.async {                     completion(users)                 }             } catch {                 completion([])             }         }         dataTask.resume()     }<\/code><\/pre>\n<p>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<pre><code class=\"swift\">private func fetchData(from url: URL) -> AnyPublisher&lt;[User], Never> {         URLSession.shared.dataTaskPublisher(for: url)             .map { $0.data }             .decode(type: [User].self, decoder: JSONDecoder())             .receive(on: DispatchQueue.main)             .replaceError(with: [])             .eraseToAnyPublisher()     }<\/code><\/pre>\n<p><strong>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/strong><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>\u041f\u043b\u044e\u0441\u044b<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041c\u0438\u043d\u0443\u0441\u044b<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043b\u043e\u0436\u043d\u043e \u00ab\u0432\u044a\u0435\u0445\u0430\u0442\u044c\u00bb \u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0427\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0435\u0448\u0435\u0432\u0438\u0437\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0435\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437-\u0437\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 \u043d\u0430\u0439\u043c\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e \u0437\u043d\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 (\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0434\u0435\u0442\u0438\u0449\u0435)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 iOS<\/h2>\n<p>\u0412 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435, \u043d\u043e \u0444\u0430\u0432\u043e\u0440\u0438\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430: RxSwift \u0438 Combine.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>RxSwift \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435 Combine \u043d\u0430 4 \u0433\u043e\u0434\u0430. \u041e\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u043f\u043e \u043d\u0435\u043c\u0443 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0438 \u043d\u0430 Stackoverflow.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 RxSwift \u2014 \u043e\u0431\u0432\u044f\u0437\u043a\u0438 \u0441 UIKit. \u041d\u0430\u043c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0432 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"swift\">let button = UIButton()  button.rx.tap.bind { \u00a0 \u00a0 \/\/ handle tap }<\/code><\/pre>\n<p>\u0412 Combine \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443, \u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u043e\u0442\u0435\u043d \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438\u00a0\u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d Apple \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043d\u043e\u0432\u044b\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u2014 SwiftUI.<\/p>\n<pre><code class=\"swift\">let button = UIButton()  button.publisher(for: .touchUpInside) \u00a0 \u00a0 .sink { \u00a0 \u00a0 \u00a0 \u00a0 \/\/ handle tap }<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0447\u0435\u0440\u0442\u0443, \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0443 \u043e\u0431\u043e\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430 \u0438 \u043f\u0440\u043e\u0442\u0438\u0432. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0432\u044f\u0437\u043e\u043a \u0441 UIkit \u043d\u0430 Combine\u00a0\u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a, \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/github.com\/CombineCommunity\/rxswift-to-combine-cheatsheet\"><u>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438\u00a0Combine \u0438 RxSwift<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ReactiveX\/RxSwift\"><u>\u0414\u043e\u043a\u0430 \u043f\u043e Rx<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developer.apple.com\/documentation\/combine\"><u>\u0414\u043e\u043a\u0430 \u043f\u043e Combine<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.swiftbysundell.com\/articles\/building-custom-combine-publishers-in-swift\/\"><u>\u041e\u0431\u0432\u044f\u0437\u043a\u0438 \u043d\u0430 Combine<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/gist.github.com\/d-date\/735fa126e37ed88ff9d0011f6dc0510b\"><u>Gist<\/u><\/a><\/p>\n<\/li>\n<\/ol>\n<h2>Hello, Combine<\/h2>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 iOS-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438, \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438, push-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0441\u043c\u0435\u043d\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c \u0437\u0432\u043e\u043d\u043a\u0435 \u0438\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0448\u0442\u043e\u0440\u043a\u0438 \u0441 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u0442\u0438\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b (delegate pattern).<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (@escaping closures).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438 (observer pattern):<\/p>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<p>Notification Center;<\/p>\n<\/li>\n<li>\n<p>KVO;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c target-action.<\/p>\n<\/li>\n<\/ul>\n<p>Combine \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0434\u0438\u043d\u044b\u0439 API \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435. \u041c\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\u00a0\u043a\u0430\u043a<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344369","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344369"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344369\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}