{"id":301417,"date":"2020-04-07T09:00:43","date_gmt":"2020-04-07T09:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301417"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-04-07T09:00:43","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301417","title":{"rendered":"Summer MVP. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u0431\u043e\u043a Kotlin?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496020\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/n7\/aj\/xm\/n7ajxmxihjfkcum7hddtqeshgie.png\"><br \/>  <em>\/ <a href=\"https:\/\/pixabay.com\/ru\/vectors\/%D1%81%D0%B8%D0%BB%D1%83%D1%8D%D1%82-%D0%B1%D0%B0%D0%BB%D0%B5%D1%82-%D1%82%D0%B0%D0%BD%D1%86%D1%8B-%D0%BF%D1%80%D1%8B%D0%B6%D0%BA%D0%B8-%D1%84%D0%B8%D1%82%D0%BD%D0%B5%D1%81-3280313\/\" rel=\"nofollow\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/a> \/<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u0430 Kotlin \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0438\u0431\u043a\u0430\u044f \u0432\u0435\u0449\u044c \u0438 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432 Java \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u0432 Kotlin \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0437\u044b\u043a\u0430 (<a href=\"https:\/\/github.com\/ktorio\/ktor\" rel=\"nofollow\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/Kodein-Framework\/Kodein-DI\" rel=\"nofollow\">\u0434\u0432\u0430<\/a>). <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u043b\u0438 Kotlin \u043d\u0430 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c (\u0438 \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0441\u043b\u043e\u043c\u0430\u043b\u0438), \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f <a href=\"https:\/\/github.com\/adevone\/summer\" rel=\"nofollow\">MVP-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Summer<\/a> \u0431\u0435\u0437 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/multiplatform.html\" rel=\"nofollow\">Kotlin Multiplatform<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"zachem-nuzhna-mvp-biblioteka\">\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 MVP \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430?<\/h1>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u0442\u0435 \u043f\u043e\u0434 Android, \u0442\u043e \u0432\u0430\u0448\u0438 Fragment \u0438 Activity \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 view \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0442 \u0438 \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 view \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0415\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u043a\u0430\u043a \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. MVP-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0438\u043b\u043b\u044e\u0437\u0438\u044e, \u0447\u0442\u043e view \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0414\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0441 view, \u043d\u043e \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>\u043f\u0440\u043e\u043a\u0441\u0438<\/code>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <a href=\"https:\/\/github.com\/moxy-community\/Moxy\" rel=\"nofollow\">Moxy<\/a> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u043a\u0441\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e APT (Annotation Processing Tool). Moxy \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 MVP-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439. \u041b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  <\/p>\n<h1 id=\"chto-ne-tak-s-apt\">\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 APT?<\/h1>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <a href=\"https:\/\/github.com\/moxy-community\/Moxy\" rel=\"nofollow\">Moxy<\/a><\/li>\n<li>\u0416\u0451\u0441\u0442\u043a\u043e \u0442\u0443\u043f\u0438\u043c<\/li>\n<li>\u0421\u0442\u0430\u0432\u0438\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@InjectViewState<\/code> \u043d\u0430 Fragment<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0443\u0447\u0443 \u043e\u0448\u0438\u0431\u043e\u043a, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0442\u0435, \u0447\u0442\u043e \u043d\u0438\u0436\u0435. \u041f\u0440\u043e Moxy \u043d\u0438 \u0441\u043b\u043e\u0432\u0430.<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code class=\"plaintext\">e: &lt;...&gt;\/kapt3\/stubs\/debug\/adev\/TestFragment.java:16: error: cannot find symbol     public TestPresenterFactory presenterFactory;            ^   symbol:   class TestPresenterFactory   location: class TestFragment<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">e: &lt;...&gt;\/kapt3\/stubs\/debug\/adev\/ui\/TestFragment.java:22: error: [ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code. public final class TestFragment extends adev.ui.BaseFragment implements adev.presentation.TestView {              ^<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/93a\/d55\/e3a\/93ad55e3ac2060373db1d13f385dc684.jpg\"><\/p>\n<p>  <\/p>\n<p>\u042f, \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e Dagger \u043e\u043f\u044f\u0442\u044c \u0441\u043b\u043e\u043c\u0430\u043b\u0441\u044f, \u0438\u0434\u0443 \u0447\u0438\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0433\u0440\u0430\u0444. \u0427\u0435\u0440\u0435\u0437 4 \u0447\u0430\u0441\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432 \u0442\u0440\u043e\u0438\u0445 \u043a\u043e\u043b\u043b\u0435\u0433, \u043c\u044b \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0441\u044f \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043b \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u044d\u043a\u0440\u0430\u043d\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043d\u0430 Fragment \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u0433. \u041d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f. \u0414\u0435\u043b\u0430\u0435\u043c Clean Project \u0432 \u043c\u043e\u0451\u043c, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043a\u044d\u0448\u0438, \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u0430\u0432\u0438\u043c \u0438 \u043e\u043f\u044f\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/49c\/b2f\/216\/49cb2f2165ba1f34ae0254ef2b65ae1a.jpg\"><\/p>\n<p>  <\/p>\n<p>\u042f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0440\u0430\u0441\u043a\u043e\u043f\u0430\u043b \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0432 \u0441\u0442\u0435\u043a\u0435 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/google\/auto\/tree\/master\/factory\" rel=\"nofollow\">AutoFactory<\/a>, \u043d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0451 \u0432 \u043c\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0442\u0430 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0430. <\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441 Dagger. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043e\u043d\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u0438\u0445 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u0441\u0451 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0442\u043e \u044d\u0442\u043e \u0432\u0430\u0441 \u043d\u0435 \u0441\u043f\u0430\u0441\u0451\u0442. \u041e\u0448\u0438\u0431\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0441 APT \u043d\u0435\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b \u0438 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u044e\u0442 \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0432 \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">APT \u0434\u043b\u044f Kotlin\/Multiplatform<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u0414\u043b\u044f Kotlin\/Multiplatform \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e API \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 Annotation Processing \u0442\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u0435\u043d. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0437\u0430\u0432\u044f\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 API \u0441 \u0441\u0438\u043b\u044c\u043d\u044b\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h1 id=\"chto-delat\">\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c?<\/h1>\n<p>  <\/p>\n<p>\u0414\u043b\u044f Android-only \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u044b\u043b\u0430 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f APT. Koin\/Kodein \u0432\u043c\u0435\u0441\u0442\u043e Dagger, \u0441\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c \u0432\u043c\u0435\u0441\u0442\u043e <a href=\"https:\/\/github.com\/sockeqwe\/fragmentargs\" rel=\"nofollow\">FragmentArgs<\/a>. Moxy \u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0435\u0437\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439. \u0411\u044b\u043b\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b <a href=\"https:\/\/developer.android.com\/jetpack\/docs\/guide\" rel=\"nofollow\">Google MVVM<\/a>, \u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u044d\u0432\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c <a href=\"https:\/\/proandroiddev.com\/livedata-with-single-events-2395dea972a8\" rel=\"nofollow\">\u043a\u043e\u0441\u0442\u044b\u043b\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u0448\u043b\u043e \u0438\u0437 \u043c\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 <a href=\"https:\/\/kotlinlang.org\/docs\/tutorials\/javascript\/kotlin-to-javascript\/kotlin-to-javascript.html\" rel=\"nofollow\">Kotlin\/JS<\/a> \u0432 2017 \u0433\u043e\u0434\u0443. \u0422\u043e\u0433\u0434\u0430 \u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/delegated-properties.html\" rel=\"nofollow\">property-\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432<\/a> \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 <a href=\"https:\/\/vuejs.org\/\" rel=\"nofollow\">VueJS<\/a> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/js-to-kotlin-interop.html\" rel=\"nofollow\">\u0441\u0443\u0444\u0444\u0438\u043a\u0441\u044b<\/a>. \u041c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438\u0448\u043b\u0430 \u043c\u044b\u0441\u043b\u044c: &quot;\u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043d\u0435 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f Fragment\/Activity?&quot; \u0422\u0430\u043a \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int }  class Presenter : BasePresenter&lt;View&gt;() {      override fun createViewProxy(view: View) = object : View {         override var counter by state(view::counter, initial = 0)     }      override fun onEnter() {         viewProxy.counter = 1     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 view \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a <code>viewProxy<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u043e\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 view. \u041a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 view \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/delegated-properties.html\" rel=\"nofollow\">property delegate<\/a>, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>state<\/code>. \u042d\u0442\u043e\u0442 \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0435\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0437 view \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u043a\u043e\u0433\u0434\u0430 view \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u0442\u0441\u044f. \u0421\u0430\u043c \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 view \u0443\u0436\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0430, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0430\u0434\u0430\u0435\u0442. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 Map. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 view \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>createViewProxy<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e \u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 <code>state<\/code> \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0435 \u0432 Map \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0442\u0443\u0442 \u0434\u0432\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0414\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>createViewProxy<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a <code>viewProxy<\/code>. \u0411\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0448. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043c\u0435\u0448\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0438\u043b\u0438 BottomSheet \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u0438 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430.<\/li>\n<li>\u041d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 view.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u044f \u0440\u0435\u0448\u0438\u043b \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430. \u041f\u043e\u0440\u043e\u0439 \u044f \u043e\u0436\u0438\u0434\u0430\u043b \u043e\u0442 \u044f\u0437\u044b\u043a\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e &quot;\u043f\u0435\u0440\u0435\u0433\u0438\u0431\u0430\u043b&quot;.<\/p>\n<p>  <\/p>\n<h1 id=\"perelom-1-sostoyanie\">\u041f\u0435\u0440\u0435\u043b\u043e\u043c \u21161. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432\u044b\u0448\u0435, <code>viewProxy<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 view. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. \u041f\u0443\u0441\u0442\u044c <code>viewProxy<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0431\u0435\u0437 view \u0432\u043e\u043e\u0431\u0449\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>state<\/code>, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 view c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043c \u043b\u044f\u043c\u0431\u0434\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int }  class Presenter : BasePresenter&lt;View&gt;() {      override val viewProxy = object : View {         override var counter by state({ ::counter }, initial = 0)     }      override fun onCreate() {         viewProxy.counter = 1     } }  abstract class BasePresenter&lt;TView&gt; {     fun &lt;T&gt; state(         rule: TView.() -&gt; KMutableProperty0&lt;T&gt;     ): StateDelegate&lt;T&gt; {} }<\/code><\/pre>\n<p>  <\/p>\n<p>Kotlin \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430: <code>obj::prop<\/code>. \u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">class A {     var b = 1     val prop = ::b }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u0434\u0443\u043c\u0430\u043b: &quot;\u0410\u0433\u0430, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e <code>this<\/code> \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f receiver-\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438!&quot;. <\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">class A {     var b = 1 }  fun A.foo() {     val prop = ::b }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0434\u0430. \u041c\u043e\u0436\u043d\u043e! \u041e\u0442\u043b\u0438\u0447\u043d\u043e! <\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u043f\u043e\u043b\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int? }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override var counter by state({ ::counter }, initial = null)     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418&#8230;<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">e: &lt;...&gt;\/adev\/presentation\/Presenter.kt: (7, 22): Type of 'counter' doesn't match the type of the overridden var-property 'public abstract var counter: Int? defined in adev.presentation.View'<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d09\/9f5\/412\/d099f54124ac4cb33c7ccb6e699cb105.jpg\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, Android Studio \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0412 \u0447\u0451\u043c \u0436\u0435 \u0434\u0435\u043b\u043e? \u041f\u043e\u0445\u043e\u0436\u0435, \u0441\u0442\u0430\u0440\u044b\u0439 frontend \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 Kotlin, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438, \u0431\u0435\u0440\u0451\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0443 <code>viewProxy<\/code>, \u0430 \u043d\u043e\u0432\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 IDE, \u0431\u0435\u0440\u0451\u0442 \u0435\u0433\u043e, \u043a\u0430\u043a \u0438 \u043d\u0430\u0434\u043e, \u0443 <code>this<\/code> \u043b\u044f\u043c\u0431\u0434\u044b, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 <code>state<\/code>. \u0417\u0430\u0431\u0430\u0432\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>counter<\/code> \u043d\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>::counter<\/code>, \u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>this::counter<\/code>, \u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u044f \u0441\u0434\u0435\u043b\u0430\u043b view \u044f\u0432\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0440\u0435\u0448\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f: \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u044f\u0432\u043d\u044b\u0445 <code>this<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">abstract class BasePresenter&lt;TView&gt; {     fun &lt;T&gt; state(         rule: (TView) -&gt; KMutableProperty0&lt;T&gt;     ): StateDelegate&lt;T&gt; {} }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int? }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override var counter by state({ it::counter }, initial = null)     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u043d\u044f \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u043e. \u0427\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f view \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0430\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043b\u0435\u043d\u044c \u0441\u0430\u043c\u043e\u043c\u0443 \u043f\u0438\u0441\u0430\u0442\u044c <code>viewProxy<\/code> \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"https:\/\/github.com\/adevone\/summer-plugin\" rel=\"nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Intellij IDEA\/Android Studio<\/a>.<\/p>\n<p>  <\/p>\n<h1 id=\"proksi-dlya-sobytiy\">\u041f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/h1>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f?<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043f\u043b\u043e\u0445\u0438\u043c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0442\u0440\u0430\u0445. \u0423\u0436\u0430\u0441. \u041f\u0435\u0447\u0430\u043b\u044c\u043a\u0430.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\">object View {     interface State {         var counter: Int     }     interface Methods {         fun showMessage(message: String)     } }  class Presenter : BasePresenter&lt;View.State, View.Methods&gt;() {      override val viewStateProxy = object : View.State {         override var counter by state({ it::counter }, initial = 0)     }      override fun onEnter() {         viewStateProxy.counter = 1         viewMethods?.showMessage(&quot;Hello!&quot;)     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0410 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u044d\u043a\u0440\u0430\u043d\u0430\u043c\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>viewMethods<\/code> \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0444\u043e\u043d\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043c\u0435\u0440\u0442\u044c. \u0427\u0443\u043c\u0430. \u0410\u043f\u043e\u043a\u0430\u043b\u0438\u043f\u0441\u0438\u0441.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"kotlin\">object View {     interface State {         var counter: Int     }     interface Methods {         fun showMessage(message: String)     } }  interface Router {     fun toNext() }  class Presenter : BasePresenter&lt;View.State, View.Methods, Router&gt;() {      override val viewStateProxy = object : View.State {         override var counter by state({ it::counter }, initial = 0)     }      override fun onEnter() {         viewStateProxy.counter = 1         viewMethods?.showMessage(&quot;Hello!&quot;)         router.toNext()     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0436\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u043a\u043e\u0434\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e. \u041f\u043e\u043c\u043e\u0433\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043c \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f. \u0422\u0430\u0449\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a: Dagger, Retrofit \u0438 Moxy. <\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/moxy-community\/Moxy\" rel=\"nofollow\">\u0412 Moxy \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/a>. \u041e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043f\u0440\u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 view.<br \/>  \u041f\u0440\u0438 <code>AddToEndSingleStrategy<\/code> \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 view.<br \/>  \u041f\u0440\u0438 <code>OneExecutionStrategy<\/code> \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 view \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e.<br \/>  \u041f\u0440\u0438 <code>SkipStrategy<\/code> \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044e <code>AddToEndSingleStrategy<\/code> \u0432 Summer \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 <code>state<\/code>. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 Kotlin \u043d\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u043b\u044f\u043c\u0431\u0434\u0443 \u0438 \u043a\u043e\u0434, \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int?     fun showMessage() }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override var counter by state({ it::counter }, initial = null)         override fun showMessage = event { it::showMessage }     } }  abstract class BasePresenter&lt;TView&gt; {     fun event(         getAction: (TView) -&gt; (() -&gt; Unit)     ) = Event(getAction) }  class Event&lt;TView&gt;(     getAction: (TView) -&gt; (() -&gt; Unit) ) : () -&gt; Unit<\/code><\/pre>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int? }  interface Events {     fun showMessage(message: String) }  class Presenter : BasePresenter&lt;View&gt;() {      override val viewProxy = object : View {         override var counter by state({ it::counter }, initial = null)     }      val showMessage = event { it::showMessage } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 View \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u043b\u044f\u043c\u0431\u0434. \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u043d\u0435 \u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0447\u0451\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u043b\u044f\u043c\u0431\u0434\u0430\u043c\u0438?<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041b\u044f\u043c\u0431\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043a\u0443\u0434\u0430-\u0442\u043e, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u2014 \u043d\u0435\u0442.<\/li>\n<li>\u0423 \u043b\u044f\u043c\u0431\u0434\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439. \u041e\u043d\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432 \u043d\u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0430\u043c.<\/li>\n<li>\u0420\u0430\u0437\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u2013 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439. \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435\u043b\u044c\u0437\u044f \u043a\u0443\u0434\u0430-\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c, \u0442\u043e \u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f \u0438 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u044f\u043c\u0431\u0434\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0451 \u0432 \u043f\u0440\u043e\u043a\u0441\u0438. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043f\u0440\u043e\u043a\u0441\u0438 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0435\u0431\u0435 \u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 Kotlin \u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u044b \u0431\u044b\u043b\u043e \u043d\u0430 \u0447\u0451\u043c-\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u041f\u0440\u043e\u043a\u0441\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f. \u0422\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0443 \u043b\u044f\u043c\u0431\u0434, \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0443 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435, \u043a\u0430\u043a \u0443 \u043b\u044f\u043c\u0431\u0434\u044b. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u0442\u043e\u0436\u0435 \u043e\u0442\u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043b\u044f\u043c\u0431\u0434 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e? <\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 Kotlin:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">override fun showMessage(message: String) {     Toast.makeText(requireContext(), &quot;message&quot;, Toast.LENGTH_LONG).show() }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u044f\u043c\u0431\u0434\u0430 \u043d\u0430 Kotlin:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">override val showMessage = { message: String -&gt;     Toast.makeText(requireContext(), &quot;message&quot;, Toast.LENGTH_LONG).show() }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 Swift:<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">fun\u0441 showMessage(message: String) {     printMessage(message) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u044f\u043c\u0431\u0434\u0430 \u043d\u0430 Swift:<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">lazy var showMessage: (String) -&gt; Void = { message in     self.printMessage(message) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u044f\u043c\u0431\u0434\u0430 \u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u3064\u2727\u03c9\u2727)\u3064<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">override val showMessage = { message: String -&gt; Unit in     printMessage(message) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e-\u0442\u043e \u044f \u0437\u0430\u043c\u0435\u0447\u0442\u0430\u043b\u0441\u044f. \u0412 \u0446\u0435\u043b\u043e\u043c, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043b\u044f\u043c\u0431\u0434 \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0430. \u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 5-6 \u043b\u044f\u043c\u0431\u0434, \u044f \u0443\u0436\u0435 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0440\u0430\u0437\u043d\u0438\u0446\u044b, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 <a href=\"https:\/\/github.com\/adevone\/summer-plugin\" rel=\"nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d<\/a>. <\/p>\n<p>  <\/p>\n<h1 id=\"perelom-2-fabrika-sobytiy\">\u041f\u0435\u0440\u0435\u043b\u043e\u043c \u21162. \u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/h1>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0441 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 view, \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u043d\u0438\u0445. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u044b\u043b \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     val showMessage: () -&gt; Unit }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override val showMessage = doOnlyWhenAttached { it.showMessage }     } }  abstract class BasePresenter&lt;TView&gt; {     fun doOnlyWhenAttached(         getAction: (TView) -&gt; (() -&gt; Unit)     ) = Event(getAction) }  class Event&lt;TView&gt;(     action: (TView) -&gt; (() -&gt; Unit) ) : () -&gt; Unit<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 Kotlin \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u0415\u0441\u0442\u044c <code>vararg<\/code>, \u043d\u043e \u0432\u0441\u0435 \u0435\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0434\u0438\u043d \u0442\u0438\u043f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0430\u0440\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f view.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     val showMessage: (message: String) -&gt; Unit }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override val showMessage = doOnlyWhenAttached { it.showMessage }     } }  abstract class BasePresenter&lt;TView&gt; {      fun doOnlyWhenAttached(         getAction: (TView) -&gt; (() -&gt; Unit)     ) = Event0(getAction)      fun &lt;T1&gt; doOnlyWhenAttached(         getAction: (TView) -&gt; ((T1) -&gt; Unit)     ) = Event1(getAction) }  class Event0&lt;TView&gt;(     action: (TView) -&gt; (() -&gt; Unit) ) : () -&gt; Unit  class Event1&lt;TView, T1&gt;(     action: (TView) -&gt; ((T1) -&gt; Unit) ) : (T1) -&gt; Unit<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">e: &lt;...&gt;\/adev\/presentation\/View.kt: (10, 22): Type of 'showMessage' is not a subtype of the overridden property 'public abstract val showMessage: (message: String) -&gt; Unit defined in adev.presentation.View'<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/235\/571\/e23\/235571e2366f32ba9d0aa25d26e8ec39.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 Kotlin \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u0438\u0437 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043e\u043a \u0432\u0437\u044f\u0442\u044c \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0435\u0440\u0451\u0442 \u043f\u0435\u0440\u0432\u0443\u044e. \u0421\u0443\u0434\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443, \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Kotlin \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u0438\u0431\u043e \u0432\u0441\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0440\u0430\u0437\u0443, \u043b\u0438\u0431\u043e \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e \u0432\u0441\u0435\u0445 <code>doOnlyWhenAttached<\/code> \u0442\u0438\u043f <code>TView<\/code> \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438 <code>T1<\/code>. \u0412\u0438\u0434\u0438\u043c\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<p>&quot;\u0425\u043e\u0440\u043e\u0448\u043e&quot; \u2013 \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>Event<\/code> \u043d\u0430 2 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>TView<\/code> \u0438 \u0442\u0438\u043f\u0430 \u043b\u044f\u043c\u0431\u0434\u044b<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e <code>Event<\/code> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043b\u044f\u043c\u0431\u0434\u044b<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     val showMessage: (message: String) -&gt; Unit }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override val showMessage = event { it.showMessage }.doOnlyWhenAttached()     } }  abstract class BasePresenter&lt;TView&gt; {     fun &lt;TAction&gt; event(getAction: (TView) -&gt; TAction) = EventBuilder(getAction)      fun EventBuilder&lt;TView, () -&gt; Unit&gt;.doOnlyWhenAttached() {         return Event0(this.getAction)     }      fun &lt;T1&gt; EventBuilder&lt;TView, (T1) -&gt; Unit&gt;.doOnlyWhenAttached() {         return Event1(this.getAction)     } }  inline class EventBuilder&lt;TView, TAction&gt;(     val getAction: (TView) -&gt; TAction )  class Event0&lt;TView&gt;(     action: (TView) -&gt; (() -&gt; Unit) ) : () -&gt; Unit  class Event1&lt;TView, T1&gt;(     action: (TView) -&gt; ((T1) -&gt; Unit) ) : (T1) -&gt; Unit<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e. \u041e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 shorthands \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     val showMessage: (message: String) -&gt; Unit     val showMessage1: (message: String) -&gt; Unit     val showMessage2: (message: String) -&gt; Unit }  class Presenter : BasePresenter&lt;View&gt;() {     override val viewProxy = object : View {         override val showMessage = event { it.showMessage }.build(RepeatLastStrategy())         override val showMessage1 = event { it.showMessage1 }.doOnlyWhenAttached()         override val showMessage2 = event { it.showMessage2 }.doExactlyOnce()     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438 \u0438 \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0438 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0433\u043e\u0442\u043e\u0432!<\/p>\n<p>  <\/p>\n<h1 id=\"blagodarnosti\">\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h1>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u0441\u0435\u0433\u043e \u0438\u0445 \u0431\u044b\u043b\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 30. \u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445 \u043c\u044b \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0432 production. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e \u0448\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 2-\u0445 \u043b\u0435\u0442. \u0418 \u0432\u043e\u0442, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0440\u0435\u043b\u0438\u0437!<\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430 Summer \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e 5 production \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. 2 \u0438\u0437 \u043d\u0438\u0445 \u2013 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0435. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 <a href=\"https:\/\/habr.com\/ru\/users\/maksimnovikov\/\" class=\"user_link\">MaksimNovikov<\/a>, <a href=\"https:\/\/habr.com\/ru\/users\/metnyov\/\" class=\"user_link\">metnyov<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/users\/deks1309\/\" class=\"user_link\">deks1309<\/a> \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u0440\u0435\u0448\u0438\u043b\u0438\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0438 \u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u0444\u0438\u0434\u0431\u044d\u043a\u0430. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/habr.com\/ru\/users\/xanderzhu\/\" class=\"user_link\">XanderZhu<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/users\/umpteenthdev\/\" class=\"user_link\">umpteenthdev<\/a> \u0437\u0430 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0438 <a href=\"https:\/\/habr.com\/ru\/users\/mowenik\/\" class=\"user_link\">mowenik<\/a> \u0437\u0430 \u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 iOS \u0447\u0430\u0441\u0442\u0438. <\/p>\n<p>  <\/p>\n<h1 id=\"patterny\">\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b<\/h1>\n<p>  <\/p>\n<p>\u0417\u0430 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043d\u0430 Summer, \u043c\u044b \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<p>  <\/p>\n<h2 id=\"podprezenter\">\u041f\u043e\u0434\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440<\/h2>\n<p>  <\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b android.widget.View, UIView \u0438\u043b\u0438 \u043f\u043e\u043f\u0430\u043f\u043e\u0432. \u0414\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c \u043f\u043e\u043f\u0430\u043f \u0435\u0449\u0451 \u043d\u0435 \u0431\u044b\u043b \u043e\u0442\u043a\u0440\u044b\u0442, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0435\u0433\u043e \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u043e\u043c \u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438, \u043f\u043e\u043f\u0430\u043f \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0422\u0430\u043a\u0436\u0435, \u0432 \u043f\u043e\u0434\u043f\u0440\u0435\u0434\u0435\u043d\u0442\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043a\u0438\u043d\u0443\u0442\u044c \u043a\u0430\u043b\u043b\u0431\u044d\u043a.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {}  class Presenter : SummerPresenter&lt;View&gt; {     override val viewProxy = object : View {}     val subPresenter = SubPresenter(         onAction = { doSomething() }     ) }  class Fragment : SummerFragment(R.layout.fragment), View {     private val presenter by bindPresenter { Presenter() }      private lateinit var popup: Popup     override fun onViewCreated(...) {         super.onViewCreated(...)         popup = Popup(presenter.subPresenter)     } }  interface SubView {     var counter: Int }  class SubPresenter(     private val onAction: () -&gt; Unit ): SummerPresenter&lt;SubView&gt;() {     override val viewProxy = object : SubView {         override var counter by state({ it::counter }, initial = 0)     } }  class Popup(     private val presenter: SubPresenter ) : &lt;...&gt;, SubView {     init {         bindPresenter { presenter }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432\u043e <a href=\"https:\/\/vuejs.org\/\" rel=\"nofollow\">VueJS<\/a> \u0438\u043b\u0438 <a href=\"http:\/\/reactjs.org\" rel=\"nofollow\">ReactJS<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"sealed-state\">sealed State<\/h2>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e <code>AddToEndSingleTagStrategy<\/code> \u0432 Moxy, \u0432 Summer \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>state<\/code> \u0441 <code>sealed<\/code> \u043a\u043b\u0430\u0441\u0441\u043e\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">sealed class ViewState {     object Loading : ViewState()     class Content(val counter) : ViewState() }  interface View {     var state: ViewState }  class Presenter : SummerPresenter&lt;View&gt;() {     override val viewProxy = object : View {         override var state by state({ it::state }, initial = ViewState.Loading)     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/habr.com\/ru\/users\/maksimnovikov\/\" class=\"user_link\">MaksimNovikov<\/a> \u0437\u0430 \u044d\u0442\u043e\u0442 \u0442\u0440\u044e\u043a.<\/p>\n<p>  <\/p>\n<h2 id=\"didset-in-kotlin\">didSet in Kotlin<\/h2>\n<p>  <\/p>\n<p>\u0412 Kotlin \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <code>set<\/code> \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b <code>didSet<\/code> \u0438 <code>didSetNotNull<\/code>, \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u044f\u0441\u044c <code>didSet<\/code> \u0438\u0437 Swift. <a href=\"https:\/\/github.com\/adevone\/summer\/blob\/master\/app\/src\/main\/java\/summer\/example\/ui\/about\/AboutFragment.kt\" rel=\"nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"obnovlenie-spiska\">\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">data class Item(val id: Int, val count: Int)  interface View {     var items: List&lt;Item&gt; }  class Presenter : SummerPresenter&lt;View&gt;() {      override val viewProxy = object : View {         override var items by state({ it::items }, initial = emptyList())     }      fun increment(id: Int) {         viewProxy.items = viewProxy.items.map { item -&gt;             if (item.id == id)                 item.copy(count = item.count + 1)             else                 item         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0437\u0434\u0435\u0441\u044c \u0432\u044b \u043d\u0435 \u0431\u0435\u0440\u0451\u0442\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 view, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u0414\u0435\u043b\u0435\u0433\u0430\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>state<\/code>, \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c <code>store<\/code> \u0438 view \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<p>  <\/p>\n<h1 id=\"vyvody\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h1>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u044f \u043d\u0430\u0448 \u043e\u043f\u044b\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Summer \u0438 Kotlin\/Multiplatform \u0432 \u0446\u0435\u043b\u043e\u043c:<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Kotlin\/Multiplatform \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0422\u0435 iOS-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u0422\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u0441 <a href=\"https:\/\/github.com\/Kotlin\/kotlinx.coroutines\" rel=\"nofollow\">\u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438<\/a>. \u042d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0434\u043b\u044f iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 \u0441 \u043d\u0438\u043c\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0441 0. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c Summer \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u043b\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432 XCode. \u0412\u0441\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 Swift. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430 \u0438 \u0434\u0435\u0431\u0430\u0433 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 Kotlin \u0432 XCode \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/github.com\/touchlab\/xcode-kotlin\" rel=\"nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043e\u0442 TouchLab<\/a>. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0443\u044e \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e \u0441\u0440\u0435\u0434\u0438 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. VIPER, Clean Swift \u0438 \u0442.\u0434. \u0412 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e MVP.<\/p>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 Kotlin. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 Summer \u0432\u0441\u0451 \u0435\u0449\u0451 \u0438 \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e, unsafe casts \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c Kotlin \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u043f\u043e\u0434 iOS \u043d\u0430 Swift \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c\u0443 view. \u041c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u044d\u0442\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0440\u043e\u0434\u0435 \u0442\u0435\u0445, \u0447\u0442\u043e \u0432\u044b\u0434\u0430\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 APT, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Summer, \u0443 \u043d\u0430\u0441 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0431\u044b\u043b\u043e.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 <code>viewProxy<\/code> \u0435\u0441\u0442\u044c boilerplate.<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">interface View {     var counter: Int }  class Presenter : SummerPresenter&lt;View&gt;() {     override val viewProxy = object : View {         override var state by state({ it::counter }, initial = 0)     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 <code>{ it::counter }<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430. \u0423 \u043d\u0430\u0441 \u0442\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/adevone\/summer-plugin\" rel=\"nofollow\">\u043f\u043b\u0430\u0433\u0438\u043d<\/a>, \u043d\u043e \u0443 \u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c. \u042f \u043f\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c lint \u043d\u0430 \u044d\u0442\u043e.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0434\u0438\u043d \u0443\u0437\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 view<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0435\u043c \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 <code>state<\/code> \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u043d\u0430 Swift. \u041d\u0430 Kotlin \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b <code>didSet<\/code> \u0438 <code>didSetNotNull<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 view. \u041d\u0430 Swift \u0432\u043d\u0443\u0442\u0440\u0438 view \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u0435\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0441\u0435\u0442\u0438. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c <code>nil<\/code>. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u2014 \u043e\u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u0432\u0430\u0441, \u0432\u0441\u0451 \u0436\u0435, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043a\u0435\u0439\u0441 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>state<\/code> \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c <code>initial<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0442\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 <code>state<\/code>, \u0430 <code>event<\/code> \u0441 <code>RepeatLastStrategy<\/code> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0432 <code>init<\/code> \u0431\u043b\u043e\u043a\u0435 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430.<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043e\u043f\u044b\u0442\u0443, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 Moxy \u043d\u0430 Summer \u0438 \u0441 Summer \u043d\u0430 Moxy \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0423 \u043c\u0435\u043d\u044f \u0431\u0435\u0437 \u0441\u043f\u0435\u0448\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 15-20 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u044d\u043a\u0440\u0430\u043d\u043e\u0432 \u0437\u0430 \u0432\u0435\u0447\u0435\u0440. \u041f\u0435\u0440\u0435\u0432\u043e\u0434 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Summer \u0443 \u043c\u0435\u043d\u044f \u0448\u0451\u043b \u043f\u043e 3-4 \u044d\u043a\u0440\u0430\u043d\u0430 \u0437\u0430 \u0432\u0435\u0447\u0435\u0440. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d VIPER. \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u0447\u0430\u0441\u0442\u043e \u0434\u0451\u0440\u0433\u0430\u043b \u043c\u0435\u0442\u043e\u0434\u044b ViewController-\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0433\u043e iOS-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u044b, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0438\u0445 \u043a \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430\u043c \u043d\u0430 Kotlin. \u041e\u043f\u044b\u0442\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 iOS, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c, \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043a\u0430 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 1-2 \u044d\u043a\u0440\u0430\u043d\u0430 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. Kotlin \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 interop \u0441\u043e Swift \u0438 Swift-\u0443 \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u043e, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u0434. \u041a\u043b\u0430\u0441\u0441\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Kotlin, \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0434\u043b\u044f Swift \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Objective-C \u0441 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<h1 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430! \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u043e Kotlin \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/adevone\/summer\" rel=\"nofollow\">Summer<\/a>. \u0411\u0443\u0434\u0443 \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0444\u0438\u0434\u0431\u044d\u043a.<\/p>\n<\/div>\n<p> \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\/post\/496020\/\"> https:\/\/habr.com\/ru\/post\/496020\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496020\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/n7\/aj\/xm\/n7ajxmxihjfkcum7hddtqeshgie.png\"><br \/>  <em>\/ <a href=\"https:\/\/pixabay.com\/ru\/vectors\/%D1%81%D0%B8%D0%BB%D1%83%D1%8D%D1%82-%D0%B1%D0%B0%D0%BB%D0%B5%D1%82-%D1%82%D0%B0%D0%BD%D1%86%D1%8B-%D0%BF%D1%80%D1%8B%D0%B6%D0%BA%D0%B8-%D1%84%D0%B8%D1%82%D0%BD%D0%B5%D1%81-3280313\/\" rel=\"nofollow\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/a> \/<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u0430 Kotlin \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0438\u0431\u043a\u0430\u044f \u0432\u0435\u0449\u044c \u0438 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432 Java \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u0432 Kotlin \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u044f\u0437\u044b\u043a\u0430 (<a href=\"https:\/\/github.com\/ktorio\/ktor\" rel=\"nofollow\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/Kodein-Framework\/Kodein-DI\" rel=\"nofollow\">\u0434\u0432\u0430<\/a>). <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u043e \u0442\u043e, \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u043b\u0438 Kotlin \u043d\u0430 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c (\u0438 \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0441\u043b\u043e\u043c\u0430\u043b\u0438), \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f <a href=\"https:\/\/github.com\/adevone\/summer\" rel=\"nofollow\">MVP-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Summer<\/a> \u0431\u0435\u0437 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/multiplatform.html\" rel=\"nofollow\">Kotlin Multiplatform<\/a>.<\/p>\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-301417","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301417","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=301417"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301417\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}