{"id":301381,"date":"2020-04-06T21:00:22","date_gmt":"2020-04-06T21:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301381"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301381","title":{"rendered":"Compositional Layout \u0432 iOS 13. \u041e\u0441\u043d\u043e\u0432\u044b"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495076\/\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c,<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043f\u043e\u043a\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 <code>UITableView<\/code> \u0438\u043b\u0438 <code>UICollectionView<\/code>. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 <strong>iOS 13<\/strong> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v3\/ko\/id\/v3koidieod2tld3tki2h0f2wc6k.png\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0432\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0440\u043e\u043b\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e, \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u043b\u0430\u0439\u0430\u0443\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 <em>AppStore<\/em>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wt\/yb\/dw\/wtybdwnr4zslldx8gql3dukj7iy.gif\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c? <\/p>\n<p>  <\/p>\n<p>\u0414\u043e iOS 13, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u0431\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0430\u043a<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0422\u0430\u0431\u043b\u0438\u0446\u0430, \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f<\/li>\n<li>\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f, \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f<\/li>\n<li>\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f, \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u043b\u0430\u0439\u0430\u0443\u0442\u043e\u043c<\/li>\n<li>\u0421\u0432\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a <code>UIScrollView<\/code> <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0440\u044f\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u042d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c<\/li>\n<li>\u0421\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>\u0421\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e<\/li>\n<li>\u0421\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <code>self-sizing<\/code> \u044f\u0447\u0435\u0435\u043a<\/li>\n<li>\u0421\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 iPad \u0438 iPhone<\/li>\n<li>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u0440\u0443\u0442\u0438\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u043c\u043e\u0433\u043b\u0438 \u0438 \u0442\u0430\u043a \u0431\u044b\u043b\u043e \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e iOS 12.<\/p>\n<p>  <\/p>\n<h3 id=\"compositional-layout\">Compositional Layout<\/h3>\n<p>  <\/p>\n<p>\u0412 iOS 13 Apple \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043d\u0430\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043b\u0430\u0439\u0430\u0443\u0442\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u043e\u043d \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0430\u043a\u0438\u0445 \u044d\u043a\u0440\u0430\u043d\u043e\u0432 \u2014 <strong>Compositional Layout<\/strong>, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 3-\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u2014 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430<\/em>, <em>\u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c<\/em> \u0438 <em>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/em>.<br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u2014 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430<\/em>, \u043e\u043d \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u0438\u0437 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445, <em>\u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c<\/em> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043b\u0430\u0439\u0430\u0443\u0442 \u043f\u043e\u0447\u0442\u0438 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u044d\u043a\u0440\u0430\u043d\u0443 \u0438 <em>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/em>, \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e, \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u0437\u0430 \u0432\u0430\u0441.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v3\/ko\/id\/v3koidieod2tld3tki2h0f2wc6k.png\"><\/p>\n<p>  <\/p>\n<p><strong>Compositional Layout<\/strong> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u043d \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043b\u0430\u0439\u0430\u0443\u0442, \u0430 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043a\u0430\u043a \u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u044b \u0442\u0430\u043a \u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432\u043c\u0435\u0441\u0442\u0435<\/strong><\/li>\n<li><strong>\u0421\u043c\u0435\u0436\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043b\u0438\u043d\u0438\u044f\u043c<\/strong><\/li>\n<li><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432\u043c\u0435\u0441\u0442\u0435<\/strong> \u2014 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u0433\u0440\u0443\u043f\u043f\u044b, \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448 \u043b\u0430\u0439\u0430\u0443\u0442, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044f \u0435\u0433\u043e \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  <strong>\u0421\u043c\u0435\u0436\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043b\u0438\u043d\u0438\u044f\u043c<\/strong> \u2014 \u043f\u0440\u0438\u043d\u0446\u0438\u043f grid-\u043b\u0430\u0439\u0430\u0443\u0442\u0430, \u043a\u0430\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 flow-\u043b\u0430\u0439\u0430\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043b\u0438\u043d\u0438\u044f\u043c, \u0442\u0430\u043a \u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043b\u0438\u043d\u0438\u044f\u043c.<br \/>  <strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f<\/strong> \u2014 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b <strong>Compositional Layout<\/strong>. \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043b\u0430\u0439\u0430\u0443\u0442\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u044d\u0442\u0438 4 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong><code>NSCollectionLayoutSize<\/code><\/strong> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430;<\/li>\n<li><strong><code>NSCollectionLayoutItem<\/code><\/strong> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043b\u0430\u0439\u0430\u0443\u0442\u0430;<\/li>\n<li><strong><code>NSCollectionLayoutGroup<\/code><\/strong> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043b\u0430\u0439\u0430\u0443\u0442\u0430, \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043b\u0430\u0439\u0443\u0442\u0430;<\/li>\n<li><strong><code>NSCollectionLayoutSection<\/code><\/strong> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0435\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432;<\/li>\n<li><strong><code>UICollectionViewCompositionalLayout<\/code><\/strong> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0430\u043c \u043b\u0430\u0439\u0430\u0443\u0442.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 <code>UICollectionViewCompositionalLayout<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">class UICollectionViewCompositionalLayout : UICollectionViewLayout { ... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>UICollectionViewCompositionalLayout<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c <code>UICollectionViewLayout<\/code>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>UICollectionView<\/code>.<\/p>\n<p>  <\/p>\n<h3 id=\"list-layout\">List Layout<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u043c storyboard-\u043f\u0440\u043e\u0435\u043a\u0442, \u0441 \u043f\u0443\u0441\u0442\u044b\u043c <code>UIViewController<\/code>, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>viewDidLoad()<\/code> \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c <code>UICollectionView<\/code> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0438 \u0432 <code>init(frame:, layout:)<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 <strong><code>UICollectionViewCompositionalLayout<\/code><\/strong>. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>UICollectionViewCompositionalLayout<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043b\u0430\u0439\u0430\u0443\u0442\u0430. \u0421\u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043b\u0430\u0439\u0430\u0443\u0442\u0430, \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u043b\u044f \u044f\u0447\u0435\u0439\u043a\u0438, \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b, \u0436\u0435\u043b\u0442\u044b\u0439 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7e\/jk\/r9\/7ejkr9pjvxbr2i-z6ckqh3h2hu8.png\"><\/p>\n<p>  <\/p>\n<p>\u0418 \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0430\u0439\u0430\u0443\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    private func createLayout() -&gt; UICollectionViewLayout {         let itemSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .fractionalHeight(1.0))         let item = NSCollectionLayoutItem(layoutSize: itemSize)          let groupSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .absolute(44))         let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])          let section = NSCollectionLayoutSection(group: group)          let layout = UICollectionViewCompositionalLayout(section: section)         return layout     }      private func configureHierarchy() {         collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: createLayout())         \/\/ ...     }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 <code>itemSize<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0443 \u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 <strong><code>NSCollectionLayoutDimension<\/code><\/strong>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043a\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<ul>\n<li><strong><code>fractionalWidth(_:)<\/code><\/strong>, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 0 \u0434\u043e 1 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442 \u0448\u0438\u0440\u0438\u043d\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, <code>0.5<\/code> \u2014 \u0448\u0438\u0440\u0438\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0448\u0438\u0440\u0438\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u044b (\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430;<\/li>\n<li><strong><code>fractionalHeight(_: )<\/code><\/strong>, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 0 \u0434\u043e 1 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442 \u0432\u044b\u0441\u043e\u0442\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u043e\u0442\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, <code>0.5<\/code> \u2014 \u0432\u044b\u0441\u043e\u0442\u0430 \u0440\u0430\u0432\u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0432\u044b\u0441\u043e\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u044b (\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430;<\/li>\n<li><strong><code>absolute(_: )<\/code><\/strong>, \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>44.0<\/code>;<\/li>\n<li><strong><code>estimated(_:)<\/code><\/strong>, \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>itemSize<\/code> \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b <code>widthDimension = .fractionalWidth(1.0)<\/code>, <code>heightDimension = .fractionalHeight(1.0)<\/code>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0435\u0433\u043e \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 \u0432\u044b\u0441\u043e\u0442\u0435 \u0438 \u0448\u0438\u0440\u0438\u043d\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0430\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b, <code>widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(44)<\/code>, \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0448\u0438\u0440\u0438\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 \u0448\u0438\u0440\u0438\u043d\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u0442\u0443 \u0433\u0440\u0443\u043f\u043f\u0443, \u0430 \u0432\u044b\u0441\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>44.0<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u0443 \u0433\u0440\u0443\u043f\u043f\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong><code>horizontal(layoutSize: , subitem: , count: )<\/code><\/strong>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0432\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e;<\/li>\n<li><strong><code>horizontal(layoutSize:, subitems: )<\/code><\/strong>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438;<\/li>\n<li><strong><code>vertical(layoutSize:, subitem:, count:)<\/code><\/strong>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0432\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e;<\/li>\n<li><strong><code>vertical(layoutSize:, subitems: )<\/code><\/strong>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438;<\/li>\n<li><strong><code>custom(layoutSize:, itemProvider: )<\/code><\/strong>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443, \u0433\u0434\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0430\u043c.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u043f\u043e\u0434\u043c\u0435\u0442\u0438\u043b\u0438, <code>.horizontal<\/code> \u0438 <code>.vertical<\/code> \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u043a \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0441\u0442\u0435\u043a\u0435, \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0435\u043d\u043d\u043e, <code>.custom<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0430\u043c\u043e\u043c\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0438\u0441\u044c \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438.<br \/>  \u041d\u0430\u0448 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0433\u0440\u0443\u043f\u043f\u044b <code>NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u043e.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u043a\u0446\u0438\u044e NSCollectionLayoutSection(group: group), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443. \u0418 \u044d\u0442\u0443 \u0441\u0435\u043a\u0446\u0438\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e <code>Compositional Layout<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0447\u0435\u043c \u043d\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e. \u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c?<\/p>\n<p>  <\/p>\n<h3 id=\"grid-layout\">Grid Layout<\/h3>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rj\/tp\/0e\/rjtp0ecy-d-dp-1sjwsfrngzijy.png\"><\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043a\u0430\u043a \u043d\u0430\u043c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430? \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u043b \u043d\u0435 \u0432\u0441\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e \u0448\u0438\u0440\u0438\u043d\u0435, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0435 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044c. <\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">let itemSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0\/4.0), \/\/ &lt;---             heightDimension: .fractionalHeight(1.0))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 4 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0435\u0432\u0430\u0439\u0441\u0430, \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0435\u0433\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qb\/r_\/6n\/qbr_6ndntgy1mbhirtidwcm_bhc.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"two-column-layout\">Two Column Layout<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0433\u0440\u0443\u043f\u043f\u044b, \u0442\u043e\u0433\u0434\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0430\u043c\u0430 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0435\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044e, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c <code>widthDimension<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mc\/gj\/vg\/mcgjvgnlhj1p9e6b6nj9xf8xtvm.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    private func createLayout() -&gt; UICollectionViewLayout {         let spacing: CGFloat = 10         let itemSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .fractionalHeight(1.0))         let item = NSCollectionLayoutItem(layoutSize: itemSize)          let groupSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .absolute(44))         let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2) \/\/ &lt;---         group.interItemSpacing = .fixed(spacing)          let section = NSCollectionLayoutSection(group: group)         section.contentInsets = .init(top: spacing, leading: spacing, bottom: spacing, trailing: spacing)         section.interGroupSpacing = spacing          let layout = UICollectionViewCompositionalLayout(section: section)         return layout     }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u0442\u0441\u0442\u0443\u043f\u044b \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 <code>group.interItemSpacing = .fixed(spacing)<\/code>, \u043e\u0442\u0441\u0442\u0443\u043f\u044b \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>section.interGroupSpacing = spacing<\/code>, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 <code>contentInset<\/code> \u0443 \u0441\u0435\u043a\u0446\u0438\u0438 <code>section.contentInsets = .init(top: spacing, leading: spacing, bottom: spacing, trailing: spacing)<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u044f\u0447\u0435\u0439\u043a\u0430 \u0441\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u0441\u0442\u0443\u043f \u0440\u0430\u0432\u044b\u0439 <code>spacing<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 <code>interItemSpacing<\/code> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043a\u0430\u043a \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>interGroupSpacing<\/code>, \u0430 \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>NSCollectionLayoutSpacing<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">class NSCollectionLayoutSpacing : NSObject, NSCopying {     class func fixed(_ fixedSpacing: CGFloat) -&gt; Self \/\/ i.e. ==     class func flexible(_ flexibleSpacing: CGFloat) -&gt; Self \/\/ i.e. &gt;=     \/\/ ... }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><strong><code>func fixed(_ fixedSpacing: )<\/code><\/strong>, \u0437\u0430\u0434\u0430\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438;<\/li>\n<li><strong><code>func flexible(_ flexibleSpacing:)<\/code><\/strong>, \u0437\u0430\u0434\u0430\u0435\u0442 \u043d\u0435 \u0441\u0442\u0440\u043e\u0433\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0432 \u0433\u0440\u0443\u043f\u043f\u0435;<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"inset-items-grid-layout\">Inset Items Grid Layout<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044f\u0447\u0435\u0439\u043a\u0438 \u0431\u044b\u043b\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438, \u0430 \u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c\u0438? \u041a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u0440\u0430\u0432\u043d\u044b, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u043c\u0435\u0442\u044c 5 \u043a\u043e\u043b\u043e\u043d\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0448\u0438\u0440\u0438\u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u044b\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 1.0\/5.0 \u043e\u0442 \u0448\u0438\u0440\u0438\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u044b, \u0430 \u0432\u044b\u0441\u043e\u0442\u0430 \u0431\u044b\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u0432\u044b\u0441\u043e\u0442\u0435 \u0433\u0440\u0443\u043f\u043f\u044b. \u0414\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0436\u0435 \u0443\u043a\u0430\u0436\u0435\u043c \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0438\u043c\u0435\u043b\u0430 \u0448\u0438\u0440\u0438\u043d\u0443 \u0441\u0435\u043a\u0446\u0438\u0438, \u0430 \u0432\u044b\u0441\u043e\u0442\u0443 \u0440\u0430\u0432\u043d\u0443\u044e 1.0\/5.0 \u0448\u0438\u0440\u0438\u043d\u044b \u0441\u0435\u043a\u0446\u0438\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0448\u0438\u0440\u0438\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441 \u0440\u0430\u0432\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 \u0438 \u0432\u044b\u0441\u043e\u0442\u043e\u0439.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c <code>.contentInsets<\/code> \u0438 \u0443 <code>NSCollectionLayoutItem<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y7\/gs\/gj\/y7gsgjqcyst2_2rlfwhd_3n77i8.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    private func createLayout() -&gt; UICollectionViewLayout {         let spacing: CGFloat = 10         let itemSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(0.2),             heightDimension: .fractionalHeight(1.0))         let item = NSCollectionLayoutItem(layoutSize: itemSize)         item.contentInsets = .init(top: spacing, leading: spacing, bottom: spacing, trailing: spacing)          let groupSize = NSCollectionLayoutSize(             widthDimension: .fractionalWidth(1.0),             heightDimension: .fractionalWidth(0.2))         let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])          let section = NSCollectionLayoutSection(group: group)         let layout = UICollectionViewCompositionalLayout(section: section)         return layout     }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"distinct-sections-layout\">Distinct Sections Layout<\/h3>\n<p>  <\/p>\n<p>\u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u043e\u0434\u0438\u043d \u043b\u0430\u0439\u0430\u0443\u0442 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438, \u043d\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u043a \u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043b\u0430\u0439\u0430\u0443\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439.<br \/>  \u0415\u0449\u0435 \u0440\u0430\u0437 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>UICollectionViewCompositionalLayout<\/code> \u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u0430\u0439\u0430\u0443\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0431\u043b\u043e\u043a\u0430 <code>UICollectionViewCompositionalLayoutSectionProvider<\/code>. <\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">typealias UICollectionViewCompositionalLayoutSectionProvider = (Int, NSCollectionLayoutEnvironment) -&gt; NSCollectionLayoutSection?  class UICollectionViewCompositionalLayout : UICollectionViewLayout {    init(section: NSCollectionLayoutSection)    init(sectionProvider: @escaping UICollectionViewCompositionalLayoutSectionProvider)    \/\/ ... }<\/code><\/pre>\n<p>  <\/p>\n<p><code>UICollectionViewCompositionalLayoutSectionProvider<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 2 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u043e \u043d\u043e\u043c\u0435\u0440 \u0441\u0435\u043a\u0446\u0438\u0438, \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0436\u0435 \u0431\u043b\u043e\u043a \u043b\u0430\u0439\u0430\u0443\u0442 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c 3 \u0441\u0435\u043a\u0446\u0438\u0438, \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043b\u0430\u0439\u0430\u0443\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0439 \u0432 \u0432\u0438\u0434\u0435 grid-\u043b\u0430\u0439\u0430\u0443\u0442\u0430 \u0441 3-\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438, \u0434\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0442\u0430\u043a \u0436\u0435 \u0432 \u0432\u0438\u0434\u0435 grid-\u043b\u0430\u0439\u0430\u0443\u0442\u0430, \u043d\u043e \u0441 5-\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/km\/dz\/49\/kmdz49rcuj9x8h4nlnyiy4xa8z4.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    enum Section: Int, CaseIterable {         case list         case grid3         case grid5          var columnCount: Int {             switch self {             case .list:                 return 1             case .grid3:                 return 3             case .grid5:                 return 5             }         }     }      private func createLayout() -&gt; UICollectionViewLayout {         let layout = UICollectionViewCompositionalLayout { (sectionIndex, layoutEnvironment) -&gt; NSCollectionLayoutSection? in              guard let sectionKind = Section(rawValue: sectionIndex) else { return nil }             let columns = sectionKind.columnCount              let itemSize = NSCollectionLayoutSize(                 widthDimension: .fractionalWidth(1.0),                 heightDimension: .fractionalHeight(1.0))             let item = NSCollectionLayoutItem(layoutSize: itemSize)             item.contentInsets = .init(top: 2, leading: 2, bottom: 2, trailing: 2)              let groupHeight = columns == 1 ?                 NSCollectionLayoutDimension.absolute(44) :                 NSCollectionLayoutDimension.fractionalWidth(0.2)              let groupSize = NSCollectionLayoutSize(                 widthDimension: .fractionalWidth(1.0),                 heightDimension: groupHeight)             let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: columns)              let section = NSCollectionLayoutSection(group: group)             section.contentInsets = .init(top: 20, leading: 20, bottom: 20, trailing: 20)             return section         }         return layout     } \/\/ ...<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"adaptive-sections-layout\">Adaptive Sections Layout<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0430\u0439\u0430\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u043c \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438, \u0442\u043e \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u044f\u0445 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <code>NSCollectionLayoutEnvironment<\/code> \u043a\u043b\u0430\u0441\u0441, \u043e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 <code>traitCollection<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">protocol NSCollectionLayoutEnvironment : NSObjectProtocol {     var container: NSCollectionLayoutContainer { get }     var traitCollection: UITraitCollection { get } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 <em>\u0441ompact<\/em> size-class \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438, \u043a\u0430\u043a \u0432 \u043b\u0430\u043d\u0434\u0441\u043a\u0430\u0439\u043f \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0430\u0439\u0444\u043e\u043d\u0430, \u0442\u043e \u043c\u044b \u0445\u043e\u0434\u0442\u0438\u043c \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0430\u0439\u0430\u0443\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430, \u0434\u0430\u0431\u044b \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.<br \/>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c <code>traitCollection.verticalSizeClass<\/code> \u0443 <code>layoutEnvironment<\/code> \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0432\u044b\u0441\u043e\u0442\u0443 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b.<br \/>  \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 \u0432 <code>container.effectiveContentSize<\/code> \u0443 <code>layoutEnvironment<\/code> \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gm\/e5\/n_\/gme5n_kxueln1vmgtazm3u-g2gg.png\"><\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432 \u043b\u0430\u043d\u0434\u0441\u043a\u0430\u0439\u043f \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/my\/m5\/6w\/mym56wfknv-tek6_s9igi6ico3a.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    enum Section: Int, CaseIterable {         case list         case grid3         case grid5          func columnCount(for width: CGFloat) -&gt; Int {             let wideMode = width &gt; 800             switch self {             case .list:                 return wideMode ? 2 : 1             case .grid3:                 return wideMode ? 6 : 3             case .grid5:                 return wideMode ? 10 : 5             }         }     }      private func createLayout() -&gt; UICollectionViewLayout {         let layout = UICollectionViewCompositionalLayout { (sectionIndex, layoutEnvironment) -&gt; NSCollectionLayoutSection? in              guard let sectionKind = Section(rawValue: sectionIndex) else { return nil }             let columns = sectionKind.columnCount(for: layoutEnvironment.container.effectiveContentSize.width)              let itemSize = NSCollectionLayoutSize(                 widthDimension: .fractionalWidth(1.0),                 heightDimension: .fractionalHeight(1.0))             let item = NSCollectionLayoutItem(layoutSize: itemSize)             item.contentInsets = .init(top: 2, leading: 2, bottom: 2, trailing: 2)              let groupHeight = layoutEnvironment.traitCollection.verticalSizeClass == .compact ?                 NSCollectionLayoutDimension.absolute(44) :                 NSCollectionLayoutDimension.fractionalWidth(0.2)              let groupSize = NSCollectionLayoutSize(                 widthDimension: .fractionalWidth(1.0),                 heightDimension: groupHeight)             let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: columns)              let section = NSCollectionLayoutSection(group: group)             section.contentInsets = .init(top: 20, leading: 20, bottom: 20, trailing: 20)             return section         }         return layout     }  \/\/ ...<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nested-groups\">Nested Groups<\/h3>\n<p>  <\/p>\n<pre><code class=\"swift\">class NSCollectionLayoutGroup : NSCollectionLayoutItem, NSCopying { ... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>NSCollectionLayoutGroup<\/code>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u0430 <code>NSCollectionLayoutItem<\/code>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eb\/w2\/0o\/ebw20oxbfq-d_htnngu2dcyls_k.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">    func createLayout() -&gt; UICollectionViewLayout {         let layout = UICollectionViewCompositionalLayout {             (sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -&gt; NSCollectionLayoutSection? in              let leadingItem = NSCollectionLayoutItem(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.7),                                                    heightDimension: .fractionalHeight(1.0)))             leadingItem.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10)              let trailingItem = NSCollectionLayoutItem(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                                    heightDimension: .fractionalHeight(0.3)))             trailingItem.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10)             let trailingGroup = NSCollectionLayoutGroup.vertical(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.3),                                                    heightDimension: .fractionalHeight(1.0)),                 subitem: trailingItem, count: 2)              let bottomNestedGroup = NSCollectionLayoutGroup.horizontal(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                                    heightDimension: .fractionalHeight(0.6)),                 subitems: [leadingItem, trailingGroup])              let topItem = NSCollectionLayoutItem(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                                heightDimension: .fractionalHeight(0.3)))             topItem.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10)              let nestedGroup = NSCollectionLayoutGroup.vertical(                 layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                                    heightDimension: .fractionalHeight(0.4)),                 subitems: [topItem, bottomNestedGroup])             let section = NSCollectionLayoutSection(group: nestedGroup)             return section          }         return layout     }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nested-groups-scrolling\">Nested Groups Scrolling<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043d\u0430 \u0441\u0447\u0435\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u043e\u043b\u0430? \u041b\u0435\u0433\u043a\u043e! \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443 \u0441\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">\/\/ ... section.orthogonalScrollingBehavior = .continuous \/\/ ...<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/po\/jm\/ni\/pojmnitfpx3rpmjfirtpi6er4gu.gif\"><\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>iOS 13 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0430\u0439\u0430\u0443\u0442\u0430 \u0434\u043b\u044f <code>UICollectionView<\/code>, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>Compositional Layout<\/strong> \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u044b \u043f\u043e\u0447\u0442\u0438 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u043e\u043c. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0430\u0439\u0430\u0443\u0442\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438:<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/TikhonovAlexander\/Collection-View-Layout-iOS13\" rel=\"nofollow\">https:\/\/github.com\/TikhonovAlexander\/Collection-View-Layout-iOS13<\/a><\/li>\n<li><a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uicollectionviewcompositionallayout\" rel=\"nofollow\">Apple: UICollectionViewCompositionalLayout<\/a><\/li>\n<li><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2019\/215\/\" rel=\"nofollow\">WWDC 2019: Advances in Collection View Layout<\/a><\/li>\n<li><a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/views_and_controls\/collection_views\/using_collection_view_compositional_layouts_and_diffable_data_sources\" rel=\"nofollow\">Apple&#8217;s sample: Using Collection View Compositional Layouts and Diffable Data Sources<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/495076\/\"> https:\/\/habr.com\/ru\/post\/495076\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/495076\/\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c,<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043f\u043e\u043a\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 <code>UITableView<\/code> \u0438\u043b\u0438 <code>UICollectionView<\/code>. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 <strong>iOS 13<\/strong> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v3\/ko\/id\/v3koidieod2tld3tki2h0f2wc6k.png\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-301381","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301381","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=301381"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301381\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}