{"id":303189,"date":"2020-05-07T15:01:05","date_gmt":"2020-05-07T15:01:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303189"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303189","title":{"rendered":"\u0410\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0435 MVC \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500870\/\">\n<h2>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0412\u0441\u0435\u043c 404! \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e IOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Apple-MVC. \u0418\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441\u0442\u0430\u0440\u0430\u044e\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445, ViewController&#8217;\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c\u0438, \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c\u0438 \u0438 \u0442\u0434. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 <b>\u043f\u0440\u043e\u0441\u0442\u043e\u0439<\/b> \u0441\u043f\u043e\u0441\u043e\u0431 \u043a\u0430\u043a \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0441\u0435\u0431\u0435, \u0436\u0438\u0437\u043d\u044c \u0441\u0435\u0431\u0435, \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0432\u0448\u0435\u043c\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 3 \u043c\u0435\u0441\u044f\u0446\u0430, \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0441\u0435\u043c ViewController&#8217;a\u043c. \u0414\u043b\u044f \u043a\u043e\u0433\u043e \u043e\u043d \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442? \u0414\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u0441 \u0447\u0438\u0441\u0442\u043e\u0439 \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. <\/p>\n<h2>\u0413\u0434\u0435 \u0436\u0435 \u0432\u0441\u0435 \u0442\u043e\u043d\u0443\u0442?<\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0441\u0435\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u043e\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 MVC.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/763\/2bb\/542\/7632bb542502b5b48563640a7a0ff13e.png\" alt=\"image\"><\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a64\/599\/a5e\/a64599a5e5f802d52180ffc2d3ecff22.png\" alt=\"image\"><\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u043d\u043e? <b>\u041d\u0435\u0442!<\/b> \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<h2>\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0435<\/h2>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Single View App. \u0412 \u043f\u043e\u043b\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u044f\u0437\u044b\u043a\u0430 \u044f \u0441\u0442\u0430\u0432\u043b\u044e Swift, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0438 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0438 CoreDat&#8217;\u044b.<\/p>\n<p>  \u042f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430, \u0442.\u043a. \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 MVC, \u0431\u0443\u0434\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 model \u0432 controller \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u043e view.<\/p>\n<p>  \u041e\u043a\u0435\u0439, \u0437\u0430\u0434\u0430\u0447\u0430 \u0435\u0441\u0442\u044c, \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0435\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u044b\u0440\u043d\u0435\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044e \u0432\u0441\u0435 \u043f\u043e \u043f\u0430\u043f\u043a\u0430\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043b\u0438 \u0433\u0434\u0435 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u043b storyboard \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. <b>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 <\/b> \u0443\u043a\u0430\u0437\u0430\u0442\u044c reuse id \u0443 cell, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b ProductCell.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/22e\/a0c\/7ab\/22ea0c7abf9bb87897310b484c561ae6.png\" alt=\"image\"><\/p>\n<p>  \u041a\u0440\u0430\u0441\u0438\u0432\u043e? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c\u2026<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 swift<\/h2>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u043d\u043e \u0438 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, view. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0441\u0435 IBOutlets, \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"swift\">\/\/ \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u043e view \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e UIKit.  import UIKit  class ShopView: UIView{     \/\/ \u041f\u043e\u0434\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0432 storyboard.      @IBOutlet weak var tableView: UITableView!     \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0448\u0435\u0439 view.      func configure(){         \/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0446\u0432\u0435\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0442\u0430\u043a \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u044b\u0441\u043e\u0442\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b...         tableView.estimatedRowHeight = 50         tableView.rowHeight = 100     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0448\u0430 view, \u0432 configure() \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f \u043b\u0438\u0448\u044c \u0437\u0430\u0434\u0430\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043d\u043e view \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439, \u0438 \u0434\u043b\u044f \u0441\u043c\u0435\u043d\u044b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f title&#8217;\u0430 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0442\u0434\u2026 \u0422\u0430\u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0435? \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e\u0433\u0434\u0430 \u0442\u0430\u043a \u043c\u0430\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e?! \u0412\u043e\u0442 \u0442\u0430\u043a \u044f \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432 controller&#8217;e: view.hideBorders(self) \u0438 \u0432\u0441\u0435, \u0430 view \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"swift\">\/\/ \u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 view \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.  func hideBorders(view: UIView){     UIView.animate(withDuration: 0.3,                    delay: 0,                    options: .curveEaseInOut,                    animations: {            \/\/ \u0418 \u0443\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0432\u044b\u0441\u043e\u0442\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 constraint.             self.createViewHeighConstraint.constant = view.bounds.height * 0.6            \/\/ \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043a\u0440\u0430\u0435\u0432, \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0442\u0435\u043d\u0438 \u0438 \u0442\u0434.             self.editButton.layer.cornerRadius = 20            self.postView.layer.shadowOpacity = 0            self.postView.layer.cornerRadius = 0            view.layoutIfNeeded()     }, completion: nil) } <\/code><\/pre>\n<p>  \u041e\u0433\u043e\u043d\u044c! \u041d\u043e \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c model. \u0418 \u0442\u0430\u043a \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0442\u043e\u0432\u0430\u0440\u044b, \u0438 \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0443\u0442 \u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b. <\/p>\n<pre><code class=\"swift\">\/\/ \u0425\u043e\u0440\u043e\u0448\u0438\u043c \u0442\u043e\u043d\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432 model \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e View. \/\/ \u0414\u0430, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c Foundation. import Foundation \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439.  public struct Product {   public let name: String } \/\/ \u041f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u0443 \u043d\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b.  public struct ProductGroup {   public let products: [Product]   public let title: String } \/\/ \u041c\u0430\u0433\u0438\u044f swift \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c(\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e extension.  extension ProductGroup{     \/\/ \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u043d\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0432\u043e\u0449\u0435\u0439(\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 Product).      public static func vegetables() -&gt; ProductGroup{        \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0432\u043e\u0449\u0435\u0439.         let products = [             Product(name: &quot;\u041e\u0433\u0443\u0440\u0446\u044b&quot;),             Product(name: &quot;\u041f\u043e\u043c\u0438\u0434\u043e\u0440\u044b&quot;),             Product(name: &quot;\u041a\u0430\u043f\u0443\u0441\u0442\u0430&quot;)         ]         \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &quot;\u041e\u0432\u043e\u0449\u0438&quot;.          return ProductGroup(products: products, title: &quot;\u041e\u0432\u043e\u0449\u0438&quot;)     } } <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u043e\u0442\u043e\u0432\u0430, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u0438\u043c. \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0432\u044c\u044e. \u0417\u0430\u0442\u0435\u043c \u044f \u0432\u044b\u043d\u0435\u0441\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432 private extension \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 model \u0432 \u043d\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"swift\">\/\/ \u0412 controller'e \u0443 \u043d\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e UIKit. import UIKit  class ShopController: UIViewController {     \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e-\u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u043d\u0435\u0435 \u043e\u0432\u043e\u0449\u0438.     private var shopModel = ProductGroup.vegetables()          \/\/ \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e (\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0432\u0430\u0442\u043e \u0434\u043b\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0441\u043c\u043e\u0442\u0440\u0438 \u0432\u043d\u0438\u0437\u0443 \u043f\u043e\u0434 \u043a\u043e\u0434\u043e\u043c)     private var shopView: ShopView! {         guard isViewLoaded else { return nil }         return (view as! ShopView)     }     \/\/ \u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 view, \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0435 \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 controller'a \u043d\u0430\u0448\u0430 view \u0442\u043e\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0430\u0441\u044c.      override func viewDidLoad() {         super.viewDidLoad()         \/\/ \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 view \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435.         configure()     } }  private extension ShopController{     \/\/ \u041d\u043e \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0438\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435.     func configure(){         shopView.tableView.delegate = self         shopView.tableView.dataSource = self     } }  \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432.  extension ShopController: UITableViewDataSource, UITableViewDelegate{      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {         \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u044f\u0447\u0435\u0435\u043a \u043f\u043e \u043a\u043e\u043b-\u0432\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438         return shopModel.products.count     }          func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {         \/\/ \u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u044f \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 reuse Id \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0442\u0430\u043a \u0432\u043e\u0442 \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c.         let cell = tableView.dequeueReusableCell(withIdentifier: &quot;ProductCell&quot;)         \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c label \u0432 cell \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430.          cell?.textLabel?.text = shopModel.products[indexPath.row].name         return cell!     } } <\/code><\/pre>\n<p>  \u041e\u0431\u0435\u0449\u0430\u043b \u043e\u0431\u044c\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u043e view, \u043d\u0435 \u0437\u0430\u0431\u044b\u043b\u0438?) \u041d\u0430\u0448\u0430 shopView \u2014 \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c isViewLoaded, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 view \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443. \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043e, \u043c\u044b \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 ShopView.<\/p>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043d\u0430\u0448\u0435 mvc \u0433\u043e\u0442\u043e\u0432\u043e! \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0436\u0430\u0442\u044c command+R \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0440\u0438 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<h2>\u0427\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u0438\u0442\u043e\u0433\u0435?<\/h2>\n<p>  <\/p>\n<ul>\n<li> \u041f\u0440\u043e\u0441\u0442\u0430\u044f, \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/li>\n<li> \u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 model, view, controller<\/li>\n<li> \u041b\u0435\u0433\u043a\u0430\u044f \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c view<\/li>\n<li> \u041b\u0435\u0433\u043a\u0430\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0432 \u0447\u0438\u0441\u0442\u043e\u0442\u0435, \u043d\u0435 \u0442\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434\u0435, \u0430 \u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0445. \u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u0430 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0431\u0430\u0433\u043e\u0432 ^^<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/500870\/\"> https:\/\/habr.com\/ru\/post\/500870\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500870\/\">\n<h2>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0412\u0441\u0435\u043c 404! \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e IOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Apple-MVC. \u0418\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441\u0442\u0430\u0440\u0430\u044e\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445, ViewController&#8217;\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c\u0438, \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c\u0438 \u0438 \u0442\u0434. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 <b>\u043f\u0440\u043e\u0441\u0442\u043e\u0439<\/b> \u0441\u043f\u043e\u0441\u043e\u0431 \u043a\u0430\u043a \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0441\u0435\u0431\u0435, \u0436\u0438\u0437\u043d\u044c \u0441\u0435\u0431\u0435, \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0432\u0448\u0435\u043c\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 3 \u043c\u0435\u0441\u044f\u0446\u0430, \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0441\u0435\u043c ViewController&#8217;a\u043c. \u0414\u043b\u044f \u043a\u043e\u0433\u043e \u043e\u043d \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442? \u0414\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u0441 \u0447\u0438\u0441\u0442\u043e\u0439 \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. <\/p>\n<h2>\u0413\u0434\u0435 \u0436\u0435 \u0432\u0441\u0435 \u0442\u043e\u043d\u0443\u0442?<\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0441\u0435\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u043e\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 MVC.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/763\/2bb\/542\/7632bb542502b5b48563640a7a0ff13e.png\" alt=\"image\"><\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a64\/599\/a5e\/a64599a5e5f802d52180ffc2d3ecff22.png\" alt=\"image\"><\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u043d\u043e? <b>\u041d\u0435\u0442!<\/b> \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<h2>\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0435<\/h2>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Single View App. \u0412 \u043f\u043e\u043b\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u044f\u0437\u044b\u043a\u0430 \u044f \u0441\u0442\u0430\u0432\u043b\u044e Swift, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0438 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0438 CoreDat&#8217;\u044b.<\/p>\n<p>  \u042f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430, \u0442.\u043a. \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 MVC, \u0431\u0443\u0434\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 model \u0432 controller \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u043e view.<\/p>\n<p>  \u041e\u043a\u0435\u0439, \u0437\u0430\u0434\u0430\u0447\u0430 \u0435\u0441\u0442\u044c, \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0435\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u044b\u0440\u043d\u0435\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044e \u0432\u0441\u0435 \u043f\u043e \u043f\u0430\u043f\u043a\u0430\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043b\u0438 \u0433\u0434\u0435 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u043b storyboard \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. <b>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 <\/b> \u0443\u043a\u0430\u0437\u0430\u0442\u044c reuse id \u0443 cell, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b ProductCell.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/22e\/a0c\/7ab\/22ea0c7abf9bb87897310b484c561ae6.png\" alt=\"image\"><\/p>\n<p>  \u041a\u0440\u0430\u0441\u0438\u0432\u043e? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c\u2026  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303189","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303189","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=303189"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303189\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}