{"id":414828,"date":"2024-06-29T23:59:47","date_gmt":"2024-06-29T23:59:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=414828"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=414828","title":{"rendered":"<span>Live coding \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0434\u043b\u044f iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u043e\u043b\u0438. \u041a\u0430\u043a\u0438\u0435 \u044d\u0442\u0430\u043f\u044b \u0432\u0441\u0435\u00a0\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\n<p><strong>\u0422\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043d\u0438\u043d\u0433.<\/strong> \u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0441\u00a0\u0440\u0435\u043a\u0440\u0443\u0442\u0435\u0440\u043e\u043c. \u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0431\u0435\u0441\u0435\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043e\u043f\u044b\u0442\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c HR \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443 \u043b\u044e\u0431\u044b\u0435 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u043e\u043b\u0438 \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u00a0\u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e\u00a0\u0434\u0430\u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u0437\u0432\u043e\u043d \u0441\u00a0HR\u2011\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u00a0\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043d\u0438\u043d\u0433. \u0420\u0435\u043a\u0440\u0443\u0442\u0435\u0440 \u043f\u043e\u00a0\u0441\u043f\u0438\u0441\u043a\u0443 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043b\u043e\u0432\u043a\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0432\u0430\u0441 \u043e\u00a0\u0432\u0435\u0449\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u043c\u0443 \u0441\u0430\u043c\u043e\u043c\u0443 \u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b, \u0430\u00a0\u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u0447\u043d\u0435\u0435 \u0432\u00a0\u043e\u0442\u0432\u0435\u0442. \u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043b\u043e\u0432\u043a\u043e \u0434\u0430\u0436\u0435 \u0432\u0430\u043c, \u043d\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0438 \u043d\u0435\u00a0\u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435.<\/strong> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043c\u0430 \u0438\u043b\u0438\u00a0\u043f\u0440\u043e\u0439\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043d\u043b\u0430\u0439\u043d\u2011\u043e\u0446\u0435\u043d\u043a\u0443, \u0432\u00a0\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 Live coding \u0441\u0435\u0441\u0441\u0438\u044e \u0438\u043b\u0438\u00a0\u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0430\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043d\u0430\u0432\u044b\u043a\u0438, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441\u00a0\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Onsite \u0432\u0441\u0442\u0440\u0435\u0447\u0430<\/strong>. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u0442\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c \u043d\u0430\u00a0\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0\u043e\u0444\u0438\u0441. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0441\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0447\u043b\u0435\u043d\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u00a0\u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c \u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0423\u00a0\u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u043a\u0443\u043b\u044c\u0442\u0443\u0440\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0430\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430\u00a0whiteboard \u0438\u043b\u0438\u00a0system design \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e<\/strong>: \u0412\u0430\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432\u00a0\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e. \u0411\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f\u00a0\u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e <s>FAANG<\/s> MANGA. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0432\u0430\u0448\u0435\u043c \u0441\u0442\u0438\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b, \u043d\u0430\u0432\u044b\u043a\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0438 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435\u0441\u044c \u0441\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438. \u0412\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u00a0\u0432\u044b \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u00a0\u0442\u0440\u0443\u0434\u043d\u044b\u043c\u0438 \u0438\u043b\u0438\u00a0\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043d\u044b\u043c\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438 \u0432\u00a0\u043f\u0440\u043e\u0448\u043b\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<h2>Live coding<\/h2>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0440\u0443\u0434\u0430. \u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0442\u043e\u043f 50-150 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p><a href=\"https:\/\/intellipaat.com\/blog\/interview-question\/ios-interview-questions\/\" rel=\"noopener noreferrer nofollow\"><u>Top iOS Interview Questions and Answers<\/u><\/a><\/p>\n<p><a href=\"https:\/\/www.hackingwithswift.com\/interview-questions\" rel=\"noopener noreferrer nofollow\"><u>Over 150 iOS interview questions<\/u><\/a><\/p>\n<p>\u041e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u043c\u0430\u043b\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0438 \u0434\u0430\u0436\u0435 \u043a\u043d\u0438\u0433.<\/p>\n<p>\u0412\u00a0\u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u0438\u0449\u0443\u0442 \u00ab\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u043b\u0434\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0442\u0435\u043a \u0437\u0430\u00a0\u043f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c. Live coding \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u00a0\u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u041a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u043d\u0438 \u043d\u0435\u00a0\u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438\u00a0\u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p>\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0432\u00a0\u0421\u041d\u0413 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u00a0\u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0live coding \u044d\u0442\u0430\u043f\u0435. \u0412\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u0435\u00a0\u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 30\u00a0\u043c\u0438\u043d\u0443\u0442, \u0430\u00a0\u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u043e\u0431\u044b\u0447\u043d\u043e, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f 1\u20132\u00a0\u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0437\u0430\u00a0\u043e\u0434\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/p>\n<h2>Thread-safe class<\/h2>\n<p>Swift \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>\u041d\u043e\u00a0\u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0\u043e\u0434\u043d\u0443 \u0438 \u0442\u0443\u00a0\u0436\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u043b\u0438\u00a0\u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430\u00a0\u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435? \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u00a0\u043b\u0438 \u043c\u044b \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0430\u00a0\u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u0432\u044b \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0\u043e\u0434\u043d\u0443 \u0438 \u0442\u0443\u00a0\u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438\u00a0\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u00a0\u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437\u00a0\u0442\u043e\u0439\u00a0\u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430\u00a0\u0437\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043d\u0435\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b? \u041e\u0442\u0432\u0435\u0442: \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\/\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f\/\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441\u00a0\u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043f\u0440\u0438\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>Array<\/code>, <code>Dictionary<\/code>, <code>Set<\/code> <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0435\u0442\u0442\u0435\u0440 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440. \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043a\u0443\u044e\u2011\u043b\u0438\u0431\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u00a0\u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u00a0\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u043d\u0435\u0439. <\/p>\n<p>\u0414\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><code>NSLock<\/code>, <code>NSRecursiveLock<\/code>, <code>pthread_mutex_t<\/code>, <code>DispatchQueue.<\/code><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445. \u041d\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"swift\">final class ThreadSafeDictionary {       func removeAll() {         \/\/Implement me     }      func removeValue(forKey key: Key) {         \/\/Implement me     }      func contains(key: Key) -> Bool {         \/\/Implement me     }      var count: Int {         \/\/Implement me     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u044b\u0434\u0430\u0441\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430\u00a0\u0434\u043b\u044f\u00a0\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0411\u043b\u043e\u043a \u0441\u00a0\u0444\u043b\u0430\u0433\u043e\u043c <code>.barrier<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0440\u044c\u0435\u0440. \u0412\u0441\u0435 \u0431\u043b\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435\u00a0\u0431\u044b\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0431\u043b\u043e\u043a \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c. \u0412\u0441\u0435 \u0431\u043b\u043e\u043a\u0438, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u0430\u0440\u044c\u0435\u0440\u0430, \u043d\u0435\u00a0\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u0434\u043e\u00a0\u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0431\u043b\u043e\u043a \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d.<\/p>\n<pre><code class=\"swift\">final class ThreadSafeDictionary&lt;Key: Hashable, Value> {          private var dictionary = [Key: Value]()     private let queue = DispatchQueue(         label: \"com.example.ThreadSafeDictionary\",         attributes: .concurrent     )      subscript(key: Key) -> Value? {         get {             var value: Value?             queue.sync {                 value = dictionary[key]             }             return value         }         set(newValue) {             queue.async(flags: .barrier) { [weak self] in                 self?.dictionary[key] = newValue             }         }     }      func removeAll() {         queue.async(flags: .barrier) { [weak self] in             self?.dictionary.removeAll()         }     }      func removeValue(forKey key: Key) {         queue.async(flags: .barrier) { [weak self] in             self?.dictionary.removeValue(forKey: key)         }     }      func contains(key: Key) -> Bool {         var contains = false         queue.sync {             contains = dictionary[key] != nil         }         return contains     }      var count: Int {         var count = 0         queue.sync {             count = dictionary.count         }         return count     } }<\/code><\/pre>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441 <code>ThreadSafeDictionary<\/code> \u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0434\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0434\u043b\u044f\u00a0\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u041c\u0435\u0442\u043e\u0434\u044b <code>removeAll<\/code>, <code>removeValue(forKey:),<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044e \u0447\u0435\u0440\u0435\u0437 <code>queue.async(flags: .barrier)<\/code>, a <code>contains(key:)<\/code> \u0438 <code>count<\/code> \u0447\u0435\u0440\u0435\u0437 <code>queue.sync<\/code> \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439\u00a0\u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>@propertyWrapper<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u00a0Swift \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 <code>os_unfair_lock<\/code>:<\/p>\n<pre><code class=\"swift\">@propertyWrapper struct Atomic&lt;Value> {     private var value: Value     private var lock = os_unfair_lock()      var wrappedValue: Value {         mutating get {             os_unfair_lock_lock(&amp;lock)             defer { os_unfair_lock_unlock(&amp;lock) }             return value         }         set {             os_unfair_lock_lock(&amp;lock)             defer { os_unfair_lock_unlock(&amp;lock) }             value = newValue         }     }      init(wrappedValue: Value) {         self.value = wrappedValue     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>Atomic<\/code> \u0438\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>value<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>value<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>lock<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>os_unfair_lock_t<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>wrappedValue<\/code> \u0438\u043c\u0435\u0435\u0442 <code>get<\/code> \u0438 <code>set<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>os_unfair_lock_lock<\/code> \u0438 <code>os_unfair_lock_unlock<\/code> \u0434\u043b\u044f\u00a0\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>defer<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043d\u0438\u043c\u0430\u043b\u0430\u0441\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u00a0\u0433\u0435\u0442\u0442\u0435\u0440\u0435 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430. \u042d\u0442\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u0430 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\">final class AtomicDictionary&lt;Key: Hashable, Value> {          private var dictionary = Atomic(wrappedValue: [Key: Value]())      subscript(key: Key) -> Value? {         get {             return dictionary.wrappedValue[key]         }         set(newValue) {             dictionary.wrappedValue[key] = newValue         }     }      func removeAll() {         dictionary.wrappedValue.removeAll()     }      func removeValue(forKey key: Key) {         dictionary.wrappedValue.removeValue(forKey: key)     }      func contains(key: Key) -> Bool {         dictionary.wrappedValue[key] != nil     }      var count: Int {         dictionary.wrappedValue.count     }  }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043f\u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u043e\u0442\u043b\u0438\u0447\u0438\u044f\u043c\u0438 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/swiftrocks.com\/thread%E2%80%91safety%E2%80%91in%E2%80%91swift\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u043e\u00a0\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<h3>DispatchGroup<\/h3>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 <code>DispatchGroup<\/code> \u0438 \u0434\u043b\u044f\u00a0\u0447\u0435\u0433\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: <\/p>\n<pre><code class=\"swift\">final class AsyncPerformer {          \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f     func performWork&lt;T>(object: T, complete: @escaping (T) -> Void) {         ...          \/\/ \u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e,         \/\/ \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438         complete(object)     }      \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439     func performWorks&lt;T>(objects: [T], complete: @escaping ([T]) -> Void) {         ...     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>performWorks<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 <code>complete<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u00a0\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u00a0\u0432\u00a0\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>performWork<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"swift\">final class AsyncPerformer {          func performWork&lt;T>(object: T, complete: @escaping (T) -> Void) {         ...          complete(object)     }      \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439     func performWorks&lt;T>(objects: [T], complete: @escaping ([T]) -> Void) {         \/\/1         let group = DispatchGroup()                 let queue = DispatchQueue(             label: \"perform.queue\",              attributes: .concurrent         )         \/\/2         var result = objects         \/\/3         group.notify(queue: DispatchQueue.main) {             complete(result)         }         \/\/4         for (index, object) in objects.enumerated() {             queue.async {                 \/\/5                 group.enter()                 performWork(object: object) { response in                     \/\/6                     queue.async(flags: .barrier) {                         result[index] = response                         \/\/7                         group.leave()                      }                 }             }         }     } }<\/code><\/pre>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 DispatchGroup \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u00a0\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u00a0\u2014 \u0447\u0442\u043e\u0431\u044b \u0432\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f\u00a0\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>notify<\/code> \u0434\u043b\u044f\u00a0\u0433\u0440\u0443\u043f\u043f\u044b. \u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0439\u0434\u0443\u0442 \u0438\u0437\u00a0\u0433\u0440\u0443\u043f\u043f\u044b, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 <code>complete<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0412\u00a0\u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043d\u0430\u00a0\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0442.\u043a. \u043f\u043e\u00a0\u0443\u0441\u043b\u043e\u0432\u0438\u044e \u043c\u0435\u0442\u043e\u0434 <code>performWork<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><code>group.enter()<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u00a0\u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>performWork<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u00a0\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u043b\u0430\u0433 <code>.barrier<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0438\u0437\u00a0\u0433\u0440\u0443\u043f\u043f\u044b \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>group.leave()<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430\u0432\u044b\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <code>DispatchGroup<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f\u00a0\u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <code>Combine<\/code> \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>collect.<\/code><\/p>\n<h2>High-order functions<\/h2>\n<p>\u0412\u00a0Swift \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430\u00a0\u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043e\u0434\u043d\u0443 \u0438\u043b\u0438\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043b\u0438\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u042d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f\u00a0\u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u0438 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445 \u0438 \u0438\u0445 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<ol>\n<li>\n<p><code>map<\/code>\u00a0\u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0442\u043e\u0433\u043e\u00a0\u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p><code>filter<\/code>\u00a0\u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0443;<\/p>\n<\/li>\n<li>\n<p> <code>reduce<\/code>\u00a0\u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0432\u00a0\u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p><code>compactMap<\/code>\u00a0\u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441\u00a0\u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"swift\">extension Collection {     func map() {         \/\/ implement me!     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"swift\">extension Collection {     func map&lt;T>(_ transform: (Element) throws -> T) rethrows -> [T] {         var result = [T]()         result.reserveCapacity(count)         for element in self {             result.append(try transform(element))         }         return result     } }<\/code><\/pre>\n<p>\u0412\u00a0\u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>map<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043a\u0430\u043a\u00a0\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>Collection<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>map<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u0438\u043f\u0430 <code>Element<\/code> \u0432\u00a0\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u0438\u043f\u0430 <code>T<\/code>. \u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <code>throws<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e\u00a0\u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. \u0421\u0430\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>map<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <code>rethrows<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e\u00a0\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>map<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0438\u043f\u0430 <code>[T]<\/code> \u0434\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041c\u0435\u0442\u043e\u0434 <code>reserveCapacity<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u00a0\u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f\u00a0\u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0447\u0442\u043e\u00a0\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0442\u0435\u043c \u0446\u0438\u043a\u043b <code>for<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u00a0\u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>try<\/code>, \u0430\u00a0\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u00a0\u043d\u043e\u0432\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0438 =)<\/p>\n<h2>Type erasure<\/h2>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b <code>Request<\/code> \u0441 <code>associated type<\/code>. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u00a0\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u043a\u044d\u0448\u043e\u043c) \u0437\u0430\u00a0\u043e\u0434\u043d\u0438\u043c \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c:<\/p>\n<pre><code class=\"swift\">protocol Request {     associatedtype Response     associatedtype Error: Swift.Error          typealias Handler = (Result&lt;Response, Error>) -> Void          var handler: Handler { get }              func perform(then handler: @escaping Handler) }<\/code><\/pre>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u2011\u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0\u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043f\u043e\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c <a href=\"https:\/\/en.wikipedia.org\/wiki\/FIFO_(computing_and_electronics)\" rel=\"noopener noreferrer nofollow\">FIFO<\/a>. <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0415\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <code>RequestQueue<\/code> \u0438 \u043c\u0435\u0442\u043e\u0434 <code>add(_ :)<\/code>. \u041d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<pre><code class=\"swift\">class RequestQueue {     \/\/ Error: protocol 'Request' can only be used as a generic     \/\/ constraint because it has Self or associated type requirements     \/\/     \/\/ Or in Swift 5.7     \/\/ Use of protocol 'Request' as a type must be written 'any Request'     func add(_ request: Request) {         ...     } }<\/code><\/pre>\n<p>\u041c\u044b \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 <code>Request<\/code> \u0442.\u043a. \u043e\u043d \u0438\u043c\u0435\u0435\u0442 <code>asso\u0441iated type<\/code>. \u0412\u00a0\u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 <code>TypeErasure<\/code>. <\/p>\n<pre><code class=\"swift\">class RequestQueue {     private var queue = [() -> Void]()     private var isPerformingRequest = false      func add&lt;R: Request>(_ request: R) {         \/\/ 1         let typeErased = {             request.perform { [weak self] result in                 request.handler(result)                 self?.isPerformingRequest = false                 self?.performNextIfNeeded()             }         }          \/\/2         queue.append(typeErased)         performNextIfNeeded()     }      \/\/3     private func performNextIfNeeded() {         guard !isPerformingRequest &amp;&amp; !queue.isEmpty else {             return         }          \/\/4         isPerformingRequest = true         let closure = queue.removeFirst()         closure()     } }<\/code><\/pre>\n<ol>\n<li>\n<p>\u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 <code>typeErased<\/code> \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u00a0\u0437\u0430\u043f\u0440\u043e\u0441 (request), \u0442\u0430\u043a \u0438 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a (handler), \u043d\u0435\u00a0\u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044f \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431\u00a0\u044d\u0442\u043e\u043c \u0442\u0438\u043f\u0435 \u0437\u0430\u00a0\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 (type erasure);<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u00a0\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u00a0\u0442\u0438\u043f\u043e\u043c <code>[() -> Void]<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>performNextIfNeeded<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0435\u0442\u00a0\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u00a0\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0435\u0441\u0442\u044c\u00a0\u043b\u0438 \u0432\u00a0\u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0435\u0449\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0435\u0441\u0442\u044c, \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u043b\u0430\u0433 <code>isPerformingRequest<\/code> \u0432 <code>true<\/code>, \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0438\u0437\u00a0\u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<h2>Any and Some<\/h2>\n<p>\u0412\u00a0Swift 5.6\u00a0\u0438 5.7\u00a0\u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 <code>type erasure<\/code>, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/swiftrocks.com\/whats-any-understanding-type-erasure-in-swift\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0335-existential-any.md\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 <code>any<\/code> \u0438 <code>some<\/code>:<\/p>\n<pre><code class=\"swift\">class RequestQueue {     private var queue = [any NewRequest]()     private var isPerformingRequest = false      func add(request: some NewRequest) {         queue.append(request)         performNextIfNeeded()     }          private func performNextIfNeeded() {         guard !isPerformingRequest &amp;&amp; !queue.isEmpty else { return }         isPerformingRequest = true                  let outgoing = queue.removeFirst()         perform(request: outgoing)     }          private func perform(request: some NewRequest) {         request.perform { [weak self] result in             request.handler(result)             self?.isPerformingRequest = false             self?.performNextIfNeeded()         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435\u00a0\u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u00a0\u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>typeErased<\/code> \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f. \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 <code>some<\/code> \u0438 <code>any<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c type erasure \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>opaque type<\/code><strong> <\/strong> \u0438 <code>existential type<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e\u00a0\u043a\u043b\u0430\u0441\u0441 <code>RequestQueue<\/code> \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u0447\u0442\u043e\u00a0\u0432\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b\u0437\u0432\u0430\u043b\u043e\u00a0\u0431\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u044e \u0437\u0430\u0434\u0430\u0447 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b \u0434\u043b\u044f\u00a0\u043b\u044e\u0431\u043e\u0433\u043e iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0426\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u0443\u043c\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0\u0442\u043e\u0439 \u0438\u043b\u0438\u00a0\u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 \u0438 \u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u00a0\u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u00a0\u0441\u0432\u043e\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u0438\u043b\u0438\u00a0\u0434\u043b\u044f\u00a0\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a\u00a0\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u043c. \u0415\u0441\u043b\u0438 \u0434\u0430\u0435\u0442\u0435 \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u00a0\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u0435\u0442 \u0432\u043e\u00a0\u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0430\u00a0\u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u0443\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0441\u00a0\u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u044f\u0437\u044b\u043a\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 IDE \u0431\u0435\u0437\u00a0\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a. \u0411\u0443\u0434\u044c\u0442\u0435 \u0441\u043d\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0432\u043e\u00a0\u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0435\u0441\u0441 \u0438 \u0432\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e, \u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0438\u043b\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u00a0\u0432\u0430\u0448\u0435\u0433\u043e.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438 \u043c\u0438\u0440\u0435 IT \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/ios_mobile_developer\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/ios_mobile_developer<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/718334\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0432\u0430\u043c \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">70.83% <\/span><span class=\"tm-article-poll__answer-label\">Thread safe collection<\/span><span class=\"tm-article-poll__answer-votes\">17<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 70.83%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">62.5% <\/span><span class=\"tm-article-poll__answer-label\">Dispatch group problem<\/span><span class=\"tm-article-poll__answer-votes\">15<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 62.5%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">25% <\/span><span class=\"tm-article-poll__answer-label\">High-order function<\/span><span class=\"tm-article-poll__answer-votes\">6<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 25%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">12.5% <\/span><span class=\"tm-article-poll__answer-label\">Type erasure<\/span><span class=\"tm-article-poll__answer-votes\">3<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 12.5%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">12.5% <\/span><span class=\"tm-article-poll__answer-label\">Any and some<\/span><span class=\"tm-article-poll__answer-votes\">3<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 12.5%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 24 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.    \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 13 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/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\/articles\/718334\/\"> https:\/\/habr.com\/ru\/articles\/718334\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u043e\u043b\u0438. \u041a\u0430\u043a\u0438\u0435 \u044d\u0442\u0430\u043f\u044b \u0432\u0441\u0435\u00a0\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\n<p><strong>\u0422\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043d\u0438\u043d\u0433.<\/strong> \u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0441\u00a0\u0440\u0435\u043a\u0440\u0443\u0442\u0435\u0440\u043e\u043c. \u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0431\u0435\u0441\u0435\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043e\u043f\u044b\u0442\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c HR \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443 \u043b\u044e\u0431\u044b\u0435 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u043e\u043b\u0438 \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u00a0\u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e\u00a0\u0434\u0430\u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u0437\u0432\u043e\u043d \u0441\u00a0HR\u2011\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u00a0\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043d\u0438\u043d\u0433. \u0420\u0435\u043a\u0440\u0443\u0442\u0435\u0440 \u043f\u043e\u00a0\u0441\u043f\u0438\u0441\u043a\u0443 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043b\u043e\u0432\u043a\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0432\u0430\u0441 \u043e\u00a0\u0432\u0435\u0449\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u043c\u0443 \u0441\u0430\u043c\u043e\u043c\u0443 \u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b, \u0430\u00a0\u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u0447\u043d\u0435\u0435 \u0432\u00a0\u043e\u0442\u0432\u0435\u0442. \u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043b\u043e\u0432\u043a\u043e \u0434\u0430\u0436\u0435 \u0432\u0430\u043c, \u043d\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0438 \u043d\u0435\u00a0\u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435.<\/strong> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043c\u0430 \u0438\u043b\u0438\u00a0\u043f\u0440\u043e\u0439\u0442\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043d\u043b\u0430\u0439\u043d\u2011\u043e\u0446\u0435\u043d\u043a\u0443, \u0432\u00a0\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 Live coding \u0441\u0435\u0441\u0441\u0438\u044e \u0438\u043b\u0438\u00a0\u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0432\u0430\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043d\u0430\u0432\u044b\u043a\u0438, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441\u00a0\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Onsite \u0432\u0441\u0442\u0440\u0435\u0447\u0430<\/strong>. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u0442\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c \u043d\u0430\u00a0\u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u00a0\u043e\u0444\u0438\u0441. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0441\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0447\u043b\u0435\u043d\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u00a0\u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c \u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0423\u00a0\u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u043a\u0443\u043b\u044c\u0442\u0443\u0440\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0430\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0441\u0441\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430\u00a0whiteboard \u0438\u043b\u0438\u00a0system design \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e<\/strong>: \u0412\u0430\u0441 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432\u00a0\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e. \u0411\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f\u00a0\u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e <s>FAANG<\/s> MANGA. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0432\u0430\u0448\u0435\u043c \u0441\u0442\u0438\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b, \u043d\u0430\u0432\u044b\u043a\u0430\u0445 \u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0438 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435\u0441\u044c \u0441\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438. \u0412\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u00a0\u0432\u044b \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u00a0\u0442\u0440\u0443\u0434\u043d\u044b\u043c\u0438 \u0438\u043b\u0438\u00a0\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043d\u044b\u043c\u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438 \u0432\u00a0\u043f\u0440\u043e\u0448\u043b\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<h2>Live coding<\/h2>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0440\u0443\u0434\u0430. \u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0442\u043e\u043f 50-150 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p><a href=\"https:\/\/intellipaat.com\/blog\/interview-question\/ios-interview-questions\/\" rel=\"noopener noreferrer nofollow\"><u>Top iOS Interview Questions and Answers<\/u><\/a><\/p>\n<p><a href=\"https:\/\/www.hackingwithswift.com\/interview-questions\" rel=\"noopener noreferrer nofollow\"><u>Over 150 iOS interview questions<\/u><\/a><\/p>\n<p>\u041e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u043c\u0430\u043b\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0438 \u0434\u0430\u0436\u0435 \u043a\u043d\u0438\u0433.<\/p>\n<p>\u0412\u00a0\u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u0438\u0449\u0443\u0442 \u00ab\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u043b\u0434\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0442\u0435\u043a \u0437\u0430\u00a0\u043f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c. Live coding \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u00a0\u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u041a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u043d\u0438 \u043d\u0435\u00a0\u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438\u00a0\u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p>\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0432\u00a0\u0421\u041d\u0413 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u00a0\u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0live coding \u044d\u0442\u0430\u043f\u0435. \u0412\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043d\u0435\u00a0\u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 30\u00a0\u043c\u0438\u043d\u0443\u0442, \u0430\u00a0\u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u043e\u0431\u044b\u0447\u043d\u043e, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f 1\u20132\u00a0\u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0437\u0430\u00a0\u043e\u0434\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/p>\n<h2>Thread-safe class<\/h2>\n<p>Swift \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>\u041d\u043e\u00a0\u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0\u043e\u0434\u043d\u0443 \u0438 \u0442\u0443\u00a0\u0436\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u043b\u0438\u00a0\u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430\u00a0\u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435? \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u00a0\u043b\u0438 \u043c\u044b \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438?<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0430\u00a0\u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u0432\u044b \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0\u043e\u0434\u043d\u0443 \u0438 \u0442\u0443\u00a0\u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438\u00a0\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u00a0\u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437\u00a0\u0442\u043e\u0439\u00a0\u0436\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430\u00a0\u0437\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043d\u0435\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b? \u041e\u0442\u0432\u0435\u0442: \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\/\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f\/\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441\u00a0\u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043f\u0440\u0438\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>Array<\/code>, <code>Dictionary<\/code>, <code>Set<\/code> <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0435\u0442\u0442\u0435\u0440 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440. \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043a\u0443\u044e\u2011\u043b\u0438\u0431\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u00a0\u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u00a0\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u043d\u0435\u0439. <\/p>\n<p>\u0414\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><code>NSLock<\/code>, <code>NSRecursiveLock<\/code>, <code>pthread_mutex_t<\/code>, <code>DispatchQueue.<\/code><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445. \u041d\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0432\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"swift\">final class ThreadSafeDictionary {       func removeAll() {         \/\/Implement me     }      func removeValue(forKey key: Key) {         \/\/Implement me     }      func contains(key: Key) -> Bool {         \/\/Implement me     }      var count: Int {         \/\/Implement me     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u044b\u0434\u0430\u0441\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430\u00a0\u0434\u043b\u044f\u00a0\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0411\u043b\u043e\u043a \u0441\u00a0\u0444\u043b\u0430\u0433\u043e\u043c <code>.barrier<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0440\u044c\u0435\u0440. \u0412\u0441\u0435 \u0431\u043b\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435\u00a0\u0431\u044b\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0431\u043b\u043e\u043a \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c. \u0412\u0441\u0435 \u0431\u043b\u043e\u043a\u0438, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u0430\u0440\u044c\u0435\u0440\u0430, \u043d\u0435\u00a0\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u0434\u043e\u00a0\u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0431\u043b\u043e\u043a \u0441\u00a0\u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d.<\/p>\n<pre><code class=\"swift\">final class ThreadSafeDictionary&lt;Key: Hashable, Value> {          private var dictionary = [Key: Value]()     private let queue = DispatchQueue(         label: \"com.example.ThreadSafeDictionary\",         attributes: .concurrent     )      subscript(key: Key) -> Value? {         get {             var value: Value?             queue.sync {                 value = dictionary[key]             }             return value         }         set(newValue) {             queue.async(flags: .barrier) { [weak self] in                 self?.dictionary[key] = newValue             }         }     }      func removeAll() {         queue.async(flags: .barrier) { [weak self] in             self?.dictionary.removeAll()         }     }      func removeValue(forKey key: Key) {         queue.async(flags: .barrier) { [weak self] in             self?.dictionary.removeValue(forKey: key)         }     }      func contains(key: Key) -> Bool {         var contains = false         queue.sync {             contains = dictionary[key] != nil         }         return contains     }      var count: Int {         var count = 0         queue.sync {             count = dictionary.count         }         return count     } }<\/code><\/pre>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441 <code>ThreadSafeDictionary<\/code> \u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0434\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0434\u043b\u044f\u00a0\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u041c\u0435\u0442\u043e\u0434\u044b <code>removeAll<\/code>, <code>removeValue(forKey:),<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044e \u0447\u0435\u0440\u0435\u0437 <code>queue.async(flags: .barrier)<\/code>, a <code>contains(key:)<\/code> \u0438 <code>count<\/code> \u0447\u0435\u0440\u0435\u0437 <code>queue.sync<\/code> \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>\u0414\u043b\u044f\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439\u00a0\u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>@propertyWrapper<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u00a0Swift \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 <code>os_unfair_lock<\/code>:<\/p>\n<pre><code class=\"swift\">@propertyWrapper struct Atomic&lt;Value> {     private var value: Value     private var lock = os_unfair_lock()      var wrappedValue: Value {         mutating get {             os_unfair_lock_lock(&amp;lock)             defer { os_unfair_lock_unlock(&amp;lock) }             return value         }         set {             os_unfair_lock_lock(&amp;lock)             defer { os_unfair_lock_unlock(&amp;lock) }             value = newValue         }     }      init(wrappedValue: Value) {         self.value = wrappedValue     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>Atomic<\/code> \u0438\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>value<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>value<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>lock<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>os_unfair_lock_t<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>wrappedValue<\/code> \u0438\u043c\u0435\u0435\u0442 <code>get<\/code> \u0438 <code>set<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>os_unfair_lock_lock<\/code> \u0438 <code>os_unfair_lock_unlock<\/code> \u0434\u043b\u044f\u00a0\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>defer<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f\u00a0\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043d\u0438\u043c\u0430\u043b\u0430\u0441\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u00a0\u0433\u0435\u0442\u0442\u0435\u0440\u0435 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430. \u042d\u0442\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u0430 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\">final class AtomicDictionary&lt;Key: Hashable, Value> {          private var dictionary = Atomic(wrappedValue: [Key: Value]())      subscript(key: Key) -> Value? {         get {             return dictionary.wrappedValue[key]         }         set(newValue) {             dictionary.wrappedValue[key] = newValue         }     }      func removeAll() {         dictionary.wrappedValue.removeAll()     }      func removeValue(forKey key: Key) {         dictionary.wrappedValue.removeValue(forKey: key)     }      func contains(key: Key) -> Bool {         dictionary.wrappedValue[key] != nil     }      var count: Int {         dictionary.wrappedValue.count     }  }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e\u0435\u0440\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043f\u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u043e\u0442\u043b\u0438\u0447\u0438\u044f\u043c\u0438 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/swiftrocks.com\/thread%E2%80%91safety%E2%80%91in%E2%80%91swift\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u043e\u00a0\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>.<\/p>\n<h3>DispatchGroup<\/h3>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 <code>DispatchGroup<\/code> \u0438 \u0434\u043b\u044f\u00a0\u0447\u0435\u0433\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: <\/p>\n<pre><code class=\"swift\">final class AsyncPerformer {          \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f     func performWork&lt;T>(object: T, complete: @escaping (T) -> Void) {         ...          \/\/ \u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e,         \/\/ \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438         complete(object)     }      \/\/ \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439     func performWorks&lt;T>(objects: [T], complete: @escaping ([T]) -> Void) {         ...     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>performWorks<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 <code>complete<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u00a0\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u00a0\u0432\u00a0\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>performWork<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-414828","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414828","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=414828"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414828\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}