{"id":336660,"date":"2022-08-06T15:00:09","date_gmt":"2022-08-06T15:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336660"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336660","title":{"rendered":"<span>SwiftUI. \u0415\u0441\u0442\u044c \u043b\u0438 \u0436\u0438\u0437\u043d\u044c \u0431\u0435\u0437 NavigationView \u0438\u043b\u0438 \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/am\/tb\/f5\/amtbf5nrtgmfubgazr5uvwlsa78.jpeg\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/am\/tb\/f5\/amtbf5nrtgmfubgazr5uvwlsa78.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 \u2013 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 iOS \u0431\u044b\u043b\u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0433\u043e\u0440\u0434\u043e \u0438\u043c\u0435\u043d\u0443\u0435\u043c\u044b\u0435 iOS-\u0434\u0435\u0432\u0435\u043b\u043e\u043f\u0435\u0440\u0430\u043c\u0438, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0438\u0441\u044c \u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430. \u041d\u0435 \u0442\u043e \u0447\u0442\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u0431\u044b\u043b \u043f\u043b\u043e\u0445 \u2013 \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0441\u044f \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u043c\u0438\u0440\u0430 Apple, \u043d\u043e \u0432\u043e\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u043b\u0430 \u00ab\u0431\u0435\u043b\u044c\u043c\u043e\u043c \u0432 \u0433\u043b\u0430\u0437\u0443\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u044e\u043a \u2013 \u0441\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u043f\u0430\u043d\u0435\u043b\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c, \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0434\u0438\u0437\u0430\u0439\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u0432\u0441\u0435 \u043a \u0442\u0435\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c push \u0438 pop \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u0434\u0430\u0436\u0435 Apple \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0430\u043b\u044c\u0448\u0435 \u0436\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0432 iOS 7&#8230; \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u0430 \u0432\u044b\u043b\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432&#8230; \u041d\u043e \u0442\u0435 \u043a\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043d\u0435\u043b\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0432\u044b\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0438\u0437 \u0442\u0435\u0445 \u043c\u0440\u0430\u0447\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e.&lt;cut \/><\/p>\n<p>&#8230;\u043f\u043e\u043a\u0430 \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 \u043d\u0435 \u0437\u0430\u043c\u0435\u043b\u044c\u0442\u0435\u0448\u0438\u043b SwiftUI.<\/p>\n<p><strong>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0441\u043a\u0430\u0437\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c.<\/strong><\/p>\n<p>\u0422\u0435 \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u0442\u043e \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043d\u0430 SwiftUI \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f NavigationView. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u0445\u043e\u0434\u0435 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0432\u044c\u044e \u0432 \u0441\u0442\u0435\u043a\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u2013 \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f, \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0410 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 UIKit \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0432\u044c\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u043d\u0430\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e SwiftUI \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u044b\u0440\u043e\u0439, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. (\u041d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u043e\u0447\u043a\u0443, \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d SwiftUI 4 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 iOS16).\u00a0<\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0436\u0434\u0430\u043b\u0438, \u0447\u0442\u043e Apple \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u043e\u043f\u0438\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0438 \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0NavigationView \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043f\u0440\u0435\u043a\u0435\u0439\u0442\u043d\u0443\u0442, \u0430 \u0432 SwiftUI 4 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 Apple, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 switch \u0432\u043c\u0435\u0441\u0442\u043e if, \u0430 \u0432\u043e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u043b\u0438 \u2013 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0436\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0438 \u0432 \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438.<\/p>\n<p>SwiftUI \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448, \u0447\u0442\u043e\u0431 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0434\u0435\u0442\u0441\u043a\u0438\u0445 \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u0439. \u041d\u043e, \u0443\u0432\u044b, \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438 \u043d\u0430\u0431\u0438\u0432\u0448\u0438\u0435 \u043e\u0441\u043a\u043e\u043c\u0438\u043d\u0443 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0440\u0438\u0447\u0435\u043c, \u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438, \u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437\u00a0NavigationView.<\/p>\n<p>\u0427\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e, \u043d\u0430 \u043f\u0443\u0442\u0438 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043c\u0443\u0448\u043a\u0438, \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0443\u043f\u0438\u0432 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0422\u0435 \u043a\u0442\u043e \u0438\u0445 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043b, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442 \u043e\u0431 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u0445, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435, \u0436\u0434\u0443\u0442 \u0441\u043f\u0430\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0443\u0434\u0430 \u043e\u0442 Apple, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0433\u043e\u0442\u043e\u0432\u0430 \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u0440\u0443\u043a\u0443 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0443\u0436\u0434\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f, \u0441\u0434\u0435\u043b\u0430\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u00a0AnyView \u0432 Swift 5.7.\u00a0\u041f\u0440\u0430\u0432\u0434\u0430, \u044d\u0442\u043e \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 iOS, \u0438 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0442\u0430\u0440\u0433\u0435\u0442\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0412 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u044f\u0445 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u00ab\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443\u00bb \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u00ab\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u00bb. \u0414\u043b\u044f \u0442\u0435\u0445, \u0443 \u043a\u043e\u0433\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 UIKit \u2013 \u043f\u0430\u0442\u0442\u0435\u0440 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e, \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0432\u043e\u0442 \u0442\u0435, \u043a\u0442\u043e \u00ab\u0440\u043e\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0432\u0435\u0442\u00bb \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e SwiftUI \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e \u0447\u0435\u043c \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c, \u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u0430\u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0432 \u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0412 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0435 \u0432 SwiftUI \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u0447\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a UIKit.<\/p>\n<figure class=\"float\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rg\/z4\/ji\/rgz4jiqcxltfgkfciknvha5x17m.gif\" alt=\"Demo\" title=\"Demo\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/rg\/z4\/ji\/rgz4jiqcxltfgkfciknvha5x17m.gif\"\/><figcaption>Demo<\/figcaption><\/figure>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439 View. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u043a\u0430\u043a\u0438\u0435 \u0443\u0433\u043e\u0434\u043d\u043e some View. \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u0432\u044c\u044e. \u0426\u0432\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0446\u0432\u0435\u0442\u043e\u0432 \u0440\u0430\u0434\u0443\u0433\u0438. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u00abBack\u00bb.<\/p>\n<p>\u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u043a\u0440\u0430\u0439\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0442\u0435\u043a\u0430 \u0432\u044c\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\">Coordinator.next(state: .root) Coordinator.next(state: .end)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0436\u0435 \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0441\u0442\u0438\u043b\u0435 UIKit \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"swift\">Coordinator.push(view:\u00a0ColoredView(index:\u00a0index\u00a0+\u00a01)) Coordinator.pop()<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c\u00a0<strong>index<\/strong>\u00a0 \u2013 \u044d\u0442\u043e \u043d\u043e\u043c\u0435\u0440 \u0446\u0432\u0435\u0442\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 Colors \u043e\u0442 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u043a \u043f\u0443\u0440\u043f\u0443\u0440\u043d\u043e\u043c\u0443).<\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e? \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u043e\u0433\u043e\u00a0ColoredView\u00a0\u2013 \u044d\u0442\u043e, \u0437\u0430\u0434\u0430\u0447\u0430 trainee-\u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"swift\">import SwiftUI  struct ColoredView: View {     var index: Int = 0      private (set) var colors:[Color] = [.red, .orange, .yellow, .green, .teal, .blue, .purple]          var body: some View {         ZStack {             TitlePlace()             HelloPlace()             NextPlace()             ModalaPlace()             CoordinatorPlace()         }         .frame(maxWidth: .infinity, maxHeight: .infinity)         .background(viewColor)     }          private var viewColor: Color {         return colors[index]     }          private func HelloPlace() -> some View {         VStack {             Text(\"Hello, World!\")             Text(\"Index \\(index)\")         }         .foregroundColor(.white)     }          private func TitlePlace() -> some View {         VStack {             HStack {                 if index > 0 {                     Button {                         Coordinator.pop()                     } label: {                         Image(systemName: \"arrow.left\")                             .foregroundColor(.white)                      }                     .padding()                 }                 Spacer()             }             .frame(height: 44)             .frame(maxWidth: .infinity)             Spacer()         }     }          private func NextPlace() -> some View {         VStack {             if index &lt; colors.count - 1 {                 Button {                     Coordinator.push(view: ColoredView(index: index + 1))                  } label: {                     Image(systemName: \"arrow.right\")                         .foregroundColor(.white)                 }             }         }         .offset(y: 44)     }      private func ModalaPlace() -> some View {         VStack {             Button {                 Coordinator.modal(view: ModalView())             } label: {                 Text(\"SHOW MODAL\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }         }         .offset(y: 120)     }      private func CoordinatorPlace() -> some View {         HStack {             Button {                 Coordinator.next(state: .root)             } label: {                 Text(\"ROOT\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }             .padding()             .border(.white, width: 1)              Button {                 Coordinator.next(state: .end)             } label: {                 Text(\"END\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }             .padding()             .border(.white, width: 1)         }         .offset(y: 200)     }  }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u043c\u0438\u0440\u0435 iOS \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u2013 \u044d\u0442\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0442\u043e, \u0447\u0442\u043e\u0431 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0445\u043e\u0434\u0438\u0442\u044c, \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430 \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0435\u0449\u0435 \u0438 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e\u0432\u0435\u0440\u0445 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u043a\u043d\u0430. \u0412 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043a\u043e\u0434\u0435 \u043e\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u043d\u043e \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0440\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0437\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u0435, \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u0438\u0435 \u0438\u043b\u0438 \u0431\u043b\u044e\u0440.<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f ColoredView \u0438 ModalView \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043e\u043a\u043d\u0430, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u2013 \u043a\u043d\u043e\u043f\u043a\u0430 \u00abBack\u00bb \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0432\u044c\u044e, \u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u043c \u2013 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e. \u041d\u0443 \u0438 \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435, \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439, \u043d\u043e \u043d\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u2013 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 ContainerView.<\/p>\n<pre><code class=\"swift\">struct ContainerView : View {     var view : AnyView      init&lt;V>(view: V) where V: View {         self.view = AnyView(view)     }      var body: some View {         view        } }<\/code><\/pre>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0432\u0435\u0441\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430. \u0421\u0438\u043d\u0433\u043b\u0442\u043e\u043d \u2013 \u044d\u0442\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u0440\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434, \u0447\u0442\u043e\u0431 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. <em>\u0412\u044b \u0436\u0435, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Dependency Injection (DI), ServiceLocator \u0438\u043b\u0438 EnvirontmentObject \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041b\u044e\u0431\u043e\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0445\u043e\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/em><\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a SwiftUI, \u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MVVM, \u0447\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437\u00a0ObservableObject.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"swift\">import SwiftUI  let Coordinator = CoordinatorService.instance  struct ContainerView : View {     var view : AnyView      init&lt;V>(view: V) where V: View {         self.view = AnyView(view)     }      var body: some View {         view        } }   final class CoordinatorService: ObservableObject {          enum State {         case root         case end     }          static let instance = CoordinatorService()          @Published var modalVisibled = false     @Published var modalView : ContainerView!     @Published var container : ContainerView!      private var stack  = [ContainerView]()          private init() {         self.push(view: ColoredView(index: 0))     }      func pop() {         guard self.stack.count > 1 else { return }         self.stack.remove(at: self.stack.count - 1)         guard let last = self.stack.last else { return }         self.container = last     }          func push&lt;V: View>(view: V) {         let containered = ContainerView(view: view)         self.stack += [containered]         self.container = containered     }               func modal&lt;V: View>(view: V) {         self.modalView = ContainerView(view: view)         withAnimation {             self.modalVisibled.toggle()         }     }      func close() {         withAnimation {             self.modalVisibled.toggle()         }     }          func next(state: State) {         switch state {             case .root :                 self.stack.removeAll()                 self.push(view: ColoredView())             case.end:                 self.push(view: ColoredView(index: 6))         }     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u00a0\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0441\u0442\u0435\u043a \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043f\u0443\u0448\u0438\u0442\u0441\u044f \u0432\u044c\u044e, \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 0, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0440\u0430\u0441\u043d\u043e\u043c\u0443 \u0446\u0432\u0435\u0442\u0443 \u0432 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0435: <strong><em>\u00ab\u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0445\u043e\u0442\u043d\u0438\u043a \u0436\u0435\u043b\u0430\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0433\u0434\u0435 \u0441\u0438\u0434\u0438\u0442 \u0444\u0430\u0437\u0430\u043d\u00bb.<\/em><\/strong> \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u043a\u0430\u043a\u043e\u0435 \u0432\u044c\u044e \u0442\u0443\u0434\u0430 \u0437\u0430\u043f\u0443\u0448\u0438\u0442\u044c. \u0412\u0430\u0436\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e\u0431 \u0431\u044b\u043b\u043e \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u044c\u044e. EmptyView \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442,\u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u00abpush\u00bb \u0438 \u00abmodal\u00bb \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c \u0432\u044c\u044e. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u044c\u044e, \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0435\u0442\u0438\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a \u00ab\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u043c\u00bb \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u0447\u0442\u043e \u0432 \u0442\u043e\u0442 \u0436\u0435 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u043e\u043a\u043e\u043d \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u044d\u0442\u043e\u043c, \u043c\u0435\u0442\u043e\u0434 \u00abpush\u00bb \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432 \u0441\u0442\u0435\u043a \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0442\u0435\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u00ab\u0441\u0442\u043e-\u043f\u044f\u0442\u044c\u0441\u043e\u0442\u00bb \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u2013 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d. \u041a\u043e\u043c\u043f\u043b\u0438\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u00abpop\u00bb \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0441\u0442\u0435\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432 \u0441\u0442\u0435\u043a\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u00abcontainer\u00bb.<\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u043c\u0435\u0442\u043e\u0434\u0443\u00a0\u00abpop\u00bb, \u0435\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u00a0\u00abpopToRoot\u00bb. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043b\u043e\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441:\u00a0<em>\u00ab\u0410 \u043a\u0430\u043a\u043e\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0442\u043e\u0440\u00bb?<\/em> \u0412\u043e\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0446\u0435\u043b\u0435\u0432\u043e\u043c\u0443 \u0432\u044c\u044e, \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <strong>\u00abnext\u00bb<\/strong> \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0430\u0448 \u0442\u0430\u0440\u0433\u0435\u0442. \u0421\u0430\u043c\u0438 \u0436\u0435 \u0432\u044c\u044e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u043a \u0432\u044b\u0431\u043e\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <strong>switch<\/strong> <em>(\u041f\u0440\u043e\u0448\u0443 \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u2013 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443, \u0445\u043e\u0442\u044f \u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c switch. \u041d\u043e, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 switch \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f)<\/em>.<\/p>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c ContextView \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0412 \u043d\u0435\u043c, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 container \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430, \u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430, \u043e\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u044c\u044e.<\/p>\n<pre><code class=\"swift\">import SwiftUI  struct ContentView: View {     @ObservedObject private var coordinator = Coordinator          var body: some View {         ZStack {             coordinator.container.view             if coordinator.modalVisibled {                 coordinator.modalView                     .transition(.move(edge: .bottom))             }         }     } }<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0414\u0435\u043c\u0438\u0441\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d. \u0412\u0438\u0448\u0435\u043d\u043a\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432  XCode Debug View Hierarchy. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0435 \u0441\u0435\u043c\u044c \u0432\u044c\u044e, \u0432 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0432\u044c\u044e \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 UIKit.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/9s\/sp\/kx\/9sspkxgzwoon_njtciqqsngt0l4.jpeg\" alt=\"XCode Debug View Hierarchy\" title=\"XCode Debug View Hierarchy\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/9s\/sp\/kx\/9sspkxgzwoon_njtciqqsngt0l4.jpeg\" data-blurred=\"true\"\/><figcaption>XCode Debug View Hierarchy<\/figcaption><\/figure>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043d\u0430\u00a0<a href=\"https:\/\/t.me\/+TjI9YXI0EXZ190Ht\" rel=\"noopener noreferrer nofollow\"><u>\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c \u043a\u0430\u043d\u0430\u043b\u0435<\/u><\/a>.<\/p>\n<p><a href=\"https:\/\/github.com\/DemonSoft\/CoordinatorSUI\" rel=\"noopener noreferrer nofollow\"><u>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0430 GitHub.<\/u><\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/681180\/\"> https:\/\/habr.com\/ru\/post\/681180\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 \u2013 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 iOS \u0431\u044b\u043b\u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0433\u043e\u0440\u0434\u043e \u0438\u043c\u0435\u043d\u0443\u0435\u043c\u044b\u0435 iOS-\u0434\u0435\u0432\u0435\u043b\u043e\u043f\u0435\u0440\u0430\u043c\u0438, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0438\u0441\u044c \u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430. \u041d\u0435 \u0442\u043e \u0447\u0442\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u0431\u044b\u043b \u043f\u043b\u043e\u0445 \u2013 \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0441\u044f \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u043c\u0438\u0440\u0430 Apple, \u043d\u043e \u0432\u043e\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u043b\u0430 \u00ab\u0431\u0435\u043b\u044c\u043c\u043e\u043c \u0432 \u0433\u043b\u0430\u0437\u0443\u00bb \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u044e\u043a \u2013 \u0441\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u043f\u0430\u043d\u0435\u043b\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c, \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0434\u0438\u0437\u0430\u0439\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u0432\u0441\u0435 \u043a \u0442\u0435\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c push \u0438 pop \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u0434\u0430\u0436\u0435 Apple \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0430\u043b\u044c\u0448\u0435 \u0436\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0432 iOS 7&#8230; \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u0430 \u0432\u044b\u043b\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432&#8230; \u041d\u043e \u0442\u0435 \u043a\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043d\u0435\u043b\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0432\u044b\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0438\u0437 \u0442\u0435\u0445 \u043c\u0440\u0430\u0447\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e.&lt;cut \/><\/p>\n<p>&#8230;\u043f\u043e\u043a\u0430 \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 \u043d\u0435 \u0437\u0430\u043c\u0435\u043b\u044c\u0442\u0435\u0448\u0438\u043b SwiftUI.<\/p>\n<p><strong>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0441\u043a\u0430\u0437\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c.<\/strong><\/p>\n<p>\u0422\u0435 \u0438\u0437 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u0442\u043e \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043d\u0430 SwiftUI \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f NavigationView. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u0445\u043e\u0434\u0435 \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0432\u044c\u044e \u0432 \u0441\u0442\u0435\u043a\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u2013 \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f, \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0410 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 UIKit \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438.\u00a0\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0432\u044c\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u043d\u0430\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e SwiftUI \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u044b\u0440\u043e\u0439, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. (\u041d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u043e\u0447\u043a\u0443, \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d SwiftUI 4 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 iOS16).\u00a0<\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0436\u0434\u0430\u043b\u0438, \u0447\u0442\u043e Apple \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u043e\u043f\u0438\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0438 \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0NavigationView \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043f\u0440\u0435\u043a\u0435\u0439\u0442\u043d\u0443\u0442, \u0430 \u0432 SwiftUI 4 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 Apple, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 switch \u0432\u043c\u0435\u0441\u0442\u043e if, \u0430 \u0432\u043e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u043b\u0438 \u2013 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0436\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0438 \u0432 \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438.<\/p>\n<p>SwiftUI \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0445\u043e\u0440\u043e\u0448, \u0447\u0442\u043e\u0431 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0434\u0435\u0442\u0441\u043a\u0438\u0445 \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u0439. \u041d\u043e, \u0443\u0432\u044b, \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438 \u043d\u0430\u0431\u0438\u0432\u0448\u0438\u0435 \u043e\u0441\u043a\u043e\u043c\u0438\u043d\u0443 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0440\u0438\u0447\u0435\u043c, \u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0438, \u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437\u00a0NavigationView.<\/p>\n<p>\u0427\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e, \u043d\u0430 \u043f\u0443\u0442\u0438 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043c\u0443\u0448\u043a\u0438, \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0443\u043f\u0438\u0432 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0422\u0435 \u043a\u0442\u043e \u0438\u0445 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043b, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442 \u043e\u0431 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u0445, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435, \u0436\u0434\u0443\u0442 \u0441\u043f\u0430\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0443\u0434\u0430 \u043e\u0442 Apple, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0433\u043e\u0442\u043e\u0432\u0430 \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u0440\u0443\u043a\u0443 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0443\u0436\u0434\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f, \u0441\u0434\u0435\u043b\u0430\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u00a0AnyView \u0432 Swift 5.7.\u00a0\u041f\u0440\u0430\u0432\u0434\u0430, \u044d\u0442\u043e \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 iOS, \u0438 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0442\u0430\u0440\u0433\u0435\u0442\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0412 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u044f\u0445 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u00ab\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443\u00bb \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u00ab\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u00bb. \u0414\u043b\u044f \u0442\u0435\u0445, \u0443 \u043a\u043e\u0433\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 UIKit \u2013 \u043f\u0430\u0442\u0442\u0435\u0440 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e, \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0432\u043e\u0442 \u0442\u0435, \u043a\u0442\u043e \u00ab\u0440\u043e\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0432\u0435\u0442\u00bb \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e SwiftUI \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e \u0447\u0435\u043c \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c, \u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u0430\u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0432 \u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0412 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0435 \u0432 SwiftUI \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u0447\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a UIKit.<\/p>\n<figure class=\"float\"><figcaption>Demo<\/figcaption><\/figure>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439 View. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u043a\u0430\u043a\u0438\u0435 \u0443\u0433\u043e\u0434\u043d\u043e some View. \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u0432\u044c\u044e. \u0426\u0432\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0446\u0432\u0435\u0442\u043e\u0432 \u0440\u0430\u0434\u0443\u0433\u0438. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u044c\u044e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u00abBack\u00bb.<\/p>\n<p>\u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u043a\u0440\u0430\u0439\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0442\u0435\u043a\u0430 \u0432\u044c\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\">Coordinator.next(state: .root) Coordinator.next(state: .end)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0436\u0435 \u043f\u043e \u0441\u0442\u0435\u043a\u0443 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0441\u0442\u0438\u043b\u0435 UIKit \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"swift\">Coordinator.push(view:\u00a0ColoredView(index:\u00a0index\u00a0+\u00a01)) Coordinator.pop()<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c\u00a0<strong>index<\/strong>\u00a0 \u2013 \u044d\u0442\u043e \u043d\u043e\u043c\u0435\u0440 \u0446\u0432\u0435\u0442\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 Colors \u043e\u0442 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u043a \u043f\u0443\u0440\u043f\u0443\u0440\u043d\u043e\u043c\u0443).<\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e? \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u043e\u0433\u043e\u00a0ColoredView\u00a0\u2013 \u044d\u0442\u043e, \u0437\u0430\u0434\u0430\u0447\u0430 trainee-\u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"swift\">import SwiftUI  struct ColoredView: View {     var index: Int = 0      private (set) var colors:[Color] = [.red, .orange, .yellow, .green, .teal, .blue, .purple]          var body: some View {         ZStack {             TitlePlace()             HelloPlace()             NextPlace()             ModalaPlace()             CoordinatorPlace()         }         .frame(maxWidth: .infinity, maxHeight: .infinity)         .background(viewColor)     }          private var viewColor: Color {         return colors[index]     }          private func HelloPlace() -> some View {         VStack {             Text(\"Hello, World!\")             Text(\"Index \\(index)\")         }         .foregroundColor(.white)     }          private func TitlePlace() -> some View {         VStack {             HStack {                 if index > 0 {                     Button {                         Coordinator.pop()                     } label: {                         Image(systemName: \"arrow.left\")                             .foregroundColor(.white)                      }                     .padding()                 }                 Spacer()             }             .frame(height: 44)             .frame(maxWidth: .infinity)             Spacer()         }     }          private func NextPlace() -> some View {         VStack {             if index &lt; colors.count - 1 {                 Button {                     Coordinator.push(view: ColoredView(index: index + 1))                  } label: {                     Image(systemName: \"arrow.right\")                         .foregroundColor(.white)                 }             }         }         .offset(y: 44)     }      private func ModalaPlace() -> some View {         VStack {             Button {                 Coordinator.modal(view: ModalView())             } label: {                 Text(\"SHOW MODAL\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }         }         .offset(y: 120)     }      private func CoordinatorPlace() -> some View {         HStack {             Button {                 Coordinator.next(state: .root)             } label: {                 Text(\"ROOT\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }             .padding()             .border(.white, width: 1)              Button {                 Coordinator.next(state: .end)             } label: {                 Text(\"END\")                     .foregroundColor(.white)                     .fontWeight(.heavy)             }             .padding()             .border(.white, width: 1)         }         .offset(y: 200)     }  }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u043c\u0438\u0440\u0435 iOS \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u2013 \u044d\u0442\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0442\u043e, \u0447\u0442\u043e\u0431 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0445\u043e\u0434\u0438\u0442\u044c, \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430 \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0435\u0449\u0435 \u0438 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e\u0432\u0435\u0440\u0445 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u043a\u043d\u0430. \u0412 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043a\u043e\u0434\u0435 \u043e\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u043d\u043e \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0440\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0437\u0430\u0442\u0435\u043d\u0435\u043d\u0438\u0435, \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u0438\u0435 \u0438\u043b\u0438 \u0431\u043b\u044e\u0440.<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f ColoredView \u0438 ModalView \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043e\u043a\u043d\u0430, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u2013 \u043a\u043d\u043e\u043f\u043a\u0430 \u00abBack\u00bb \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0432\u044c\u044e, \u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u043c \u2013 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e. \u041d\u0443 \u0438 \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435, \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439, \u043d\u043e \u043d\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u2013 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 ContainerView.<\/p>\n<pre><code class=\"swift\">struct ContainerView : View {     var view : AnyView      init&lt;V>(view: V) where V: View {         self.view = AnyView(view)     }      var body: some View {         view        } }<\/code><\/pre>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0432\u0435\u0441\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430. \u0421\u0438\u043d\u0433\u043b\u0442\u043e\u043d \u2013 \u044d\u0442\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u0440\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434, \u0447\u0442\u043e\u0431 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. <em>\u0412\u044b \u0436\u0435, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Dependency Injection (DI), ServiceLocator \u0438\u043b\u0438 EnvirontmentObject \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041b\u044e\u0431\u043e\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0445\u043e\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/em><\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a SwiftUI, \u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MVVM, \u0447\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437\u00a0ObservableObject.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"swift\">import SwiftUI  let Coordinator = CoordinatorService.instance  struct ContainerView : View {     var view : AnyView      init&lt;V>(view: V) where V: View {         self.view = AnyView(view)     }      var body: some View {         view        } }   final class CoordinatorService: ObservableObject {          enum State {         case root         case end     }          static let instance = CoordinatorService()          @Published var modalVisibled = false     @Published var modalView : ContainerView!     @Published var container : ContainerView!      private var stack  = [ContainerView]()          private init() {         self.push(view: ColoredView(index: 0))     }      func pop() {         guard self.stack.count > 1 else { return }         self.stack.remove(at: self.stack.count - 1)         guard let last = self.stack.last else { return }         self.container = last     }          func push&lt;V: View>(view: V) {         let containered = ContainerView(view: view)         self.stack += [containered]         self.container = containered     }               func modal&lt;V: View>(view: V) {         self.modalView = ContainerView(view: view)         withAnimation {             self.modalVisibled.toggle()         }     }      func close() {         withAnimation {             self.modalVisibled.toggle()         }     }          func next(state: State) {         switch state {             case .root :<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336660","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336660","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=336660"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336660\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}