{"id":14212,"date":"2021-07-24T16:15:47","date_gmt":"2021-07-24T16:15:47","guid":{"rendered":"https:\/\/bestkora.com\/IosDeveloper\/?p=14212"},"modified":"2021-08-18T07:56:30","modified_gmt":"2021-08-18T07:56:30","slug":"lektsiya-5-svojstva-layout-viewbuilder-cs193p-spring-2021","status":"publish","type":"post","link":"https:\/\/bestkora.com\/IosDeveloper\/lektsiya-5-svojstva-layout-viewbuilder-cs193p-spring-2021\/","title":{"rendered":"\u041b\u0435\u043a\u0446\u0438\u044f 5. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Layout @ViewBuilder.  CS193P Spring 2021."},"content":{"rendered":"<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14220 size-full\" src=\"https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47.png\" alt=\"\" width=\"2042\" height=\"1376\" srcset=\"https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47.png 2042w, https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47-300x202.png 300w, https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47-1024x690.png 1024w, https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47-768x518.png 768w, https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47-1536x1035.png 1536w, https:\/\/bestkora.com\/IosDeveloper\/wp-content\/uploads\/2021\/07\/Screenshot-2021-07-25-at-12.42.47-445x300.png 445w\" sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" \/><\/a>\u042d\u0442\u043e \u043f\u044f\u0442\u0430\u044f \u041b\u0435\u043a\u0446\u0438\u044f \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/cs193p.sites.stanford.edu\/\">Stanford CS193p, \u0432\u0435\u0441\u043d\u0430 2021 \u0433\u043e\u0434\u0430, <\/a>\u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0441\u043e <strong>SwiftUI<\/strong>, \u0442\u0430\u043a \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u044f\u0437\u044b\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Swift<\/strong>.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u043e <strong>SwiftUI<\/strong> \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0442\u0435\u043c\u044b:<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #9b0509;\">@State<\/span><\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u0421\u0438\u0441\u0442\u0435\u043c\u0430 <code>Layout<\/code> (\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>) \u0432 <strong><code>SwiftUI<\/code><\/strong>.<\/span>\n<ol>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">HStack<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">VStack<\/span><\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">LazyHStack<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">LazyVStack<\/span><\/strong>, <strong><span style=\"color: #680da1;\">LazyHGrid<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">LazyVGrid<\/span><\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">GeometryReader<\/span><\/strong>. <strong><span style=\"color: #680da1;\">CGSize<\/span><\/strong>, <strong><span style=\"color: #680da1;\">CGFloat<\/span><\/strong>, <strong><span style=\"color: #680da1;\">CGRect<\/span><\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">ZStack<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">.background<\/span> <\/strong>\u0438 <strong><span style=\"color: #680da1;\">.overlay<\/span><\/strong>.<\/span><\/li>\n<\/ol>\n<\/li>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">View<\/span><\/strong> \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/span><\/li>\n<li><span style=\"font-weight: 400;\"><strong><span style=\"color: #680da1;\">@ViewBuilder.<\/span><\/strong>\u00a0<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Swift<\/strong>, \u0442\u043e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u041f\u043e\u043b \u0425\u044d\u0433\u0435\u0440\u0442\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0451 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e <strong>Swift<\/strong> &#171;\u0441 \u043d\u0443\u043b\u044f&#187; \u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u041b\u0435\u043a\u0446\u0438\u0438 5 \u043e\u0441\u0432\u0435\u0449\u0430\u0435\u0442 \u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445:<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\">\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c (<strong><span style=\"color: #d80a77;\">private<\/span><\/strong>, <strong><span style=\"color: #d80a77;\">private (set)<\/span><\/strong> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435).<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (<strong><span style=\"color: #d80a77;\">get{}<\/span><\/strong> \u0438 <strong><span style=\"color: #d80a77;\">set {}<\/span><\/strong>).<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <strong><span style=\"color: #d80a77;\">extension<\/span><\/strong>.\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 (Property Observer) \u0438 \u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432.\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0432 <strong>Swift<\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"><span style=\"color: #d80a77;\"><strong>typealias<\/strong><\/span>, &#171;\u0432\u044b\u0432\u043e\u0434 \u0422\u0418\u041f\u0430 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430&#187; (inference), \u00a0\u201c\u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u201d \u201c<strong><span style=\"color: #680da1;\"> _<\/span><\/strong>\u201d \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/span><\/li>\n<\/ol>\n<p><!--more--><\/p>\n<h2><span style=\"color: #9b0509;\"><b>@State<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u00a0\u0412\u0430\u0448\u0438 <strong><span style=\"color: #680da1;\">Views <\/span><\/strong>\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u041c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0438\u0441\u0443\u044e\u0442 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c <strong><span style=\"color: #0000ff;\">Model<\/span><\/strong>. \u0418\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0451 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0438\u043c\u0435\u0442\u044c \u0443 <strong><span style=\"color: #680da1;\">View<\/span><\/strong> \u043d\u0438\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 <strong><span style=\"color: #d80a77;\">let<\/span><\/strong> \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <strong><span style=\"color: #d80a77;\">var<\/span><\/strong> c get-only \u0441\u0442\u0438\u043b\u0435\u043c. \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041d\u043e\u00a0\u0435\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <strong><span style=\"color: #680da1;\">@ObservedObject <\/span><\/strong>\u0438 <strong><span style=\"color: #9b0509;\">@State<\/span><\/strong>. <strong><span style=\"color: #9b0509;\">@State <\/span><\/strong>\u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e <span style=\"color: #680da1;\"><strong>View<\/strong><\/span>, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0445 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u044d\u0442\u0438 <strong><span style=\"color: #9b0509;\">@State<\/span><\/strong> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <strong><span style=\"color: #d80a77;\">var<\/span><\/strong> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <strong><span style=\"color: #d80a77;\">private<\/span><\/strong>.<\/span><\/p>\n<h2><b>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c &#8212; \u044d\u0442\u043e \u0437\u0430\u0449\u0438\u0442\u0430 \u0432\u0430\u0448\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0438\u0445 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u041f\u043e \u0441\u0443\u0442\u0438, \u043b\u044e\u0431\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong><span style=\"color: #d80a77;\">func<\/span><\/strong> \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <strong><span style=\"color: #d80a77;\">var<\/span><\/strong> \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u043c \u0432\u0430\u043c\u0438 \u043a\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <strong><span style=\"color: #d80a77;\">struct<\/span><\/strong> \u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <strong><span style=\"color: #d80a77;\">class<\/span><\/strong>, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a <strong><span style=\"color: #d80a77;\">private<\/span><\/strong> \u0438\u043b\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, <strong><span style=\"color: #d80a77;\">private (set)<\/span><\/strong>. \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <strong><span style=\"color: #d80a77;\">func<\/span><\/strong> \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <strong><span style=\"color: #d80a77;\">var<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 API (\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435), \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u043b\u044e\u0434\u044f\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <strong><span style=\"color: #d80a77;\">struct<\/span> <\/strong>\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <strong><span style=\"color: #d80a77;\">class<\/span><\/strong>.\u00a0\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u041c\u0438\u0440\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u0442\u044c <strong><span style=\"color: #d80a77;\">public<\/span><\/strong>, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e <strong><span style=\"color: #d80a77;\">private<\/span><\/strong>, <strong><span style=\"color: #d80a77;\">open<\/span><\/strong>, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <strong>public<\/strong>, \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, <strong><span style=\"color: #d80a77;\">internal<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u043e\u043b \u0425\u044d\u0433\u0435\u0440\u0442\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043a\u043e\u0434\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (<strong>ViewModel<\/strong>, <span style=\"color: #0000ff;\"><strong>Model<\/strong><\/span>, <strong><span style=\"color: #680da1;\">View<\/span><\/strong>) \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/span><\/p>\n<h2><b>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <span style=\"color: #d80a77;\">extension<\/span> \u0438 \u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (Property Observer)<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 (computed property) \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 <strong><span style=\"color: #d80a77;\">extension<\/span><\/strong> \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u0434, \u043d\u043e \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0435\u0433\u043e \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043b\u044e\u0434\u0438 \u043f\u0443\u0442\u0430\u044e\u0442 \u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (Property Observers) <strong><span style=\"color: #d80a77;\">willSet {&#8230;}<\/span><\/strong> \u0438 <strong><span style=\"color: #d80a77;\">didSet {&#8230;}<\/span><\/strong> \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 (computed properties). \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (Property Observers)\u00a0 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 (computed properties), \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (Property Observers)\u00a0 &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u0435\u0449\u044c, \u0447\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (computed properties), \u0445\u043e\u0442\u044f \u0438\u043c\u0435\u044e\u0442 \u0441\u0445\u043e\u0436\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <strong>Swift<\/strong> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c <strong>\u0412\u0410\u041c<\/strong> \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <strong><span style=\"color: #d80a77;\">struct<\/span><\/strong> \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/span><\/p>\n<h2><b>\u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435: Layout<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">\u00a0\u041d\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u043c \u041b\u0435\u043a\u0446\u0438\u0438 5 \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>Layout<\/strong>, \u0442\u043e \u0435\u0441\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c, \u0413\u0414\u0415 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 <strong><span style=\"color: #680da1;\">Views<\/span><\/strong> \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.\u00a0\u0421\u043f\u043e\u0441\u043e\u0431, \u043a\u0430\u043a\u0438\u043c <strong>SwiftUI<\/strong> \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e, &#8212; \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u042d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u0432\u043e \u0432\u0441\u0451\u043c <strong>SwiftUI<\/strong><strong>.<\/strong> \u041d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e 4 \u0448\u0430\u0433\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>SwiftUI<\/strong> \u00a0\u0438 \u043e\u043d\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u041b\u0435\u043a\u0446\u0438\u0438 5.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0441\u0432\u043e\u0451 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043a\u0438\u00a0<strong><span style=\"color: #680da1;\">HStack<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">VStack<\/span><\/strong>, <strong><span style=\"color: #680da1;\">ZStack<\/span><\/strong>, &#171;\u043b\u0435\u043d\u0438\u0432\u044b\u0435&#187; \u0441\u0442\u0435\u043a\u0438 <strong><span style=\"color: #680da1;\">LazyHStack<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">LazyVStack<\/span><\/strong>, &#171;\u043b\u0435\u043d\u0438\u0432\u044b\u0435&#187; &#171;\u0441\u0435\u0442\u043a\u0438&#187; <strong><span style=\"color: #680da1;\">LazyHGrid<\/span><\/strong>\u00a0\u0438 <strong><span style=\"color: #680da1;\">LazyVGrid<\/span><\/strong>, \u043f\u043e\u0447\u0435\u043c\u0443 <strong><span style=\"color: #680da1;\">ForEach<\/span><\/strong> \u201c\u043f\u0435\u0440\u0435\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u201d \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043c\u0435\u0436\u0434\u0443 \u0441\u0432\u043e\u0438\u043c\u0438 <strong><span style=\"color: #680da1;\">Views<\/span><\/strong> \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0441\u0442\u0435\u043a\u0438\u00a0<strong><span style=\"color: #680da1;\">HStack<\/span><\/strong>\u00a0\u0438 <strong><span style=\"color: #680da1;\">VStack<\/span><\/strong>,\u00a0\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong><span style=\"color: #680da1;\">Spacer<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">Divider<\/span><\/strong>, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 &#171;\u0433\u0438\u0431\u043a\u0438\u0435&#187; \u0438 &#171;\u043d\u0435\u0433\u0438\u0431\u043a\u0438\u0435&#187; <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435\u00a0<strong><span style=\"color: #680da1;\">.layoutPriority<\/span><\/strong>, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u00a0<code>Layout<\/code>, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong><span style=\"color: #680da1;\">GeometryReader<\/span><\/strong>, \u043a\u0430\u043a \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 <strong><span style=\"color: #680da1;\">SafeArea<\/span><\/strong> \u0432 <strong>Layout<\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u044d\u043c\u043e\u0434\u0437\u0438 (\u0441\u043c\u0430\u0439\u043b\u0438\u043a\u0438) \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b \u043f\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0440\u0442\u044b \u0438\u0433\u0440\u044b <strong>Memorize<\/strong>.\u00a0<\/span><\/p>\n<h2><span style=\"color: #680da1;\"><b>ViewModifier<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b <strong><span style=\"color: #680da1;\">ViewModifiers<\/span><\/strong> \u043f\u043e\u0432\u0441\u044e\u0434\u0443 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 <strong>Memorize<\/strong>: <strong><span style=\"color: #680da1;\">aspectRatio<\/span><\/strong>, <strong><span style=\"color: #680da1;\">padding<\/span><\/strong>, <strong><span style=\"color: #680da1;\">font<\/span><\/strong>, <strong><span style=\"color: #680da1;\">foregroundColor<\/span><\/strong>. \u0412\u0441\u0435 \u043e\u043d\u0438 \u2014 <strong><span style=\"color: #680da1;\">ViewModifiers<\/span><\/strong>. \u041e\u043d\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442 <strong><span style=\"color: #680da1;\">View<\/span><\/strong> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u043e\u0432\u043e\u0435 <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440.<br \/>\n\u0412\u043e\u0442, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b <strong><span style=\"color: #680da1;\">ViewModifiers<\/span><\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041d\u0430 \u044d\u0442\u043e\u0439 \u041b\u0435\u043a\u0446\u0438\u0438 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438\u00a0 <strong><span style=\"color: #680da1;\">.background<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">.overlay<\/span><\/strong> &#8212; \u044d\u0442\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432, \u043a\u0430\u043a\u043e\u0439 \u0443\u0433\u043e\u0434\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0438 \u0434\u0430\u0439, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0435\u0433\u043e <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442. \u041d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 <strong>Layout<\/strong> \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>. \u0421\u0430\u043c\u044b\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u044d\u0442\u043e\u0433\u043e \u0440\u043e\u0434\u0430 &#8212; <strong><span style=\"color: #680da1;\">.padding<\/span><\/strong>\u00a0\u0438 <strong><span style=\"color: #680da1;\">.aspectRatio<\/span><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043e\u0447\u0435\u043d\u044c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u0439 \u041b\u0435\u043a\u0446\u0438\u0438.<\/span><\/p>\n<h2><span style=\"font-weight: 400; color: #680da1;\"><strong>@ViewBuilder<\/strong><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f <span style=\"color: #680da1;\"><strong>@ViewBuilder<\/strong><\/span>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u0432\u0441\u044e\u0434\u0443 \u0432 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430. <strong><span style=\"color: #680da1;\">@ViewBuilder <\/span><\/strong>\u0431\u044b\u043b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <strong><span style=\"color: #680da1;\">ZStack<\/span><\/strong>, <strong><span style=\"color: #680da1;\">ForEach<\/span><\/strong> \u0438 <strong><span style=\"color: #680da1;\">LazyVGrid<\/span><\/strong> \u0438 \u0432\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u043c\u00a0 <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0412 \u044d\u0442\u043e\u0439 \u041b\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0447\u0435\u0442\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e <strong><span style=\"color: #680da1;\">@ViewBuilder<\/span>\u00a0<\/strong>\u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043e\u0431\u0449\u0435\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 Swift \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043c\u044b \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0438\u043c\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0412\u0441\u0451, \u043a \u0447\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f\u00a0 <strong><span style=\"color: #680da1;\">@ViewBuilder<\/span><\/strong>, \u0431\u0443\u0434\u044c \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u0430\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043e\u043a<span style=\"color: #680da1;\"><strong> {&#8230;} <\/strong><\/span>\u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043d \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043e\u043a <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>. \u041e\u043d \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u0438 <strong><span style=\"color: #680da1;\">Views<\/span><\/strong> \u0432 \u043e\u0434\u043d\u043e <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u0438 \u044d\u0442\u043e\u00a0 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 <strong><span style=\"color: #680da1;\">View<\/span><\/strong>,\u00a0 <strong>some<\/strong> <strong><span style=\"color: #680da1;\">View<\/span><\/strong>, \u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044d\u0442\u0443 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0441\u043f\u0438\u0441\u043a\u0430 <strong><span style=\"color: #680da1;\">Views <\/span><\/strong>\u0434\u043b\u044f \u0432\u0430\u0441 \u201c\u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438\u201d \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u0430\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0422\u0430\u043a \u0447\u0442\u043e \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u0443\u044e read-only(\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f) \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong><span style=\"color: #d80a77;\">var<\/span><\/strong>, \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u043a <strong><span style=\"color: #d80a77;\">var<\/span><span style=\"color: #680da1;\"> body<\/span><\/strong>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong><span style=\"color: #680da1;\">@ViewBuilder<\/span><\/strong>. \u0412\u043d\u0443\u0442\u0440\u0438<strong><span style=\"color: #680da1;\"> @ViewBuilders<\/span><\/strong> \u043d\u0430\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0435\u0449\u0438: \u0438\u043c\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a <strong><span style=\"color: #680da1;\">Views<\/span><\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<strong><span style=\"color: #d80a77;\"> if-else<\/span><\/strong>, <strong><span style=\"color: #d80a77;\">switch<\/span><\/strong>\u00a0\u0438 <strong><span style=\"color: #d80a77;\">if let<\/span><\/strong>\u00a0\u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430, \u043a\u0430\u043a\u0438\u0435 <strong><span style=\"color: #680da1;\">Views<\/span><\/strong> \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041a\u043e\u0434 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u041b\u0435\u043a\u0446\u0438\u0438 5 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430<a href=\"https:\/\/github.com\/BestKora\/Demo-Winter-2017\"><strong>\u00a0<\/strong><\/a><a href=\"https:\/\/github.com\/BestKora\/CS193P-Spring-2021-iOS14\"><strong>Github<\/strong><\/a>\u00a0\u0434\u043b\u044f <strong>iOS 14<\/strong>\u00a0\u0432 \u043f\u0430\u043f\u043a\u0435 Memorize\u00a0<strong>L5<\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0420\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0439 \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442 \u041b\u0435\u043a\u0446\u0438\u0438 5, \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439, \u0445\u0440\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 <strong>PDF<\/strong>-\u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c offline, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435\u00a0<strong>Google Doc<\/strong>\u00a0\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430<strong>\u00a0<a title=\"\u0414\u043e\u0441\u0442\u0443\u043f \u043a 1-\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 (\u043b\u0435\u043a\u0446\u0438\u0438 1-5) iOS 14\" href=\"https:\/\/bestkora.com\/IosDeveloper\/dostup-k-1-oj-chasti-ios-14\/\">\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435<\/a>.<\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u042d\u0442\u043e \u043f\u044f\u0442\u0430\u044f \u041b\u0435\u043a\u0446\u0438\u044f \u043a\u0443\u0440\u0441\u0430 Stanford CS193p, \u0432\u0435\u0441\u043d\u0430 2021 \u0433\u043e\u0434\u0430, \u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0441\u043e SwiftUI, \u0442\u0430\u043a \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u044f\u0437\u044b\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Swift.\u00a0 \u041f\u043e SwiftUI \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0442\u0435\u043c\u044b: @State. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 Layout (\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c &hellip; <a href=\"https:\/\/bestkora.com\/IosDeveloper\/lektsiya-5-svojstva-layout-viewbuilder-cs193p-spring-2021\/\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71,72,14,62,54],"tags":[70,80,73,74,56,79,78],"class_list":["post-14212","post","type-post","status-publish","format-standard","hentry","category-ios-14","category-stanford-cs-193p-ios-14","category-swift","category-swift-5","category-swiftui","tag-ios-14","tag-lecture-5","tag-stanford-cs193p-spring-2021","tag-swift-5-4","tag-swiftui","tag-lektsiya-5","tag-lektsiya-ios-14"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/posts\/14212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/comments?post=14212"}],"version-history":[{"count":4,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/posts\/14212\/revisions"}],"predecessor-version":[{"id":14238,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/posts\/14212\/revisions\/14238"}],"wp:attachment":[{"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/media?parent=14212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/categories?post=14212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestkora.com\/IosDeveloper\/wp-json\/wp\/v2\/tags?post=14212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}