{"id":290095,"date":"2018-09-29T19:55:02","date_gmt":"2018-09-29T15:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290095"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290095","title":{"rendered":"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u0416\u0438\u043b \u0431\u044b\u043b \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0439 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <em>VCYellow<\/em>. \u0418 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443 \u043d\u0435\u0433\u043e \u043d\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u043d\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u0438 \u0434\u0430\u0436\u0435 \u043c\u0430\u043b\u044e\u0441\u0435\u043d\u044c\u043a\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438. \u0416\u0438\u043b \u043e\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0441\u043a\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0415\u0433\u043e \u0442\u043e\u0432\u0430\u0440\u0438\u0449 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <em>VCMain<\/em> \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u043c\u0438\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code>class VCMain: UIViewController { ... @IBAction func onBtnTapMeTapped(_ sender: Any) {     let vcYellow = self.storyboard!.instantiateViewController(withIdentifier: &quot;VCYellow&quot;) as! VCYellow     self.present(vcYellow, animated: true, completion: nil) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 <em>VCYellow<\/em> \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043a\u0440\u044b\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 &quot;X&quot;, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d, \u043a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u043e\u0447\u0435\u043d\u044c \u0433\u043e\u0440\u0434\u0438\u043b\u0441\u044f:<\/p>\n<p>  <\/p>\n<pre><code>class VCYellow: UIViewController { ... @IBAction func onBtnCloseTapped(_ sender: Any) {     self.dismiss(animated: true, completion: nil) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u0438 \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wk\/tl\/b4\/wktlb4m-hcmjrf8_qpvycz9p0eg.gif\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0431\u044b\u043b\u0430 \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u0440\u043e\u044f \u043c\u0435\u0447\u0442\u0430 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e-\u043a\u0440\u0430\u0441\u043e\u0442\u0435. \u0414\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u044d\u0442\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0443 \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0442\u043e\u043c \u043f\u043e \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u043a\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0447\u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ev\/c7\/oz\/evc7ozq2dgznnwbm0h9mry7brko.gif\"\/><\/p>\n<p>  <\/p>\n<p>\u0428\u043b\u0438 \u0433\u043e\u0434\u0430\u2026 \u0438 \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0431\u044b \u043c\u0435\u0447\u0442\u0430 \u043c\u0435\u0447\u0442\u043e\u0439, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u0443\u0437\u043d\u0430\u043b <em>VCYellow<\/em> \u043e \u043c\u0430\u0433\u0438\u0438 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code>UIViewControllerTransitioningDelegate<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0441\u0438\u043b\u0430 \u044d\u0442\u043e\u0439 \u043c\u0430\u0433\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u043e\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u0438 \u0434\u043b\u044f \u0441\u043a\u0440\u044b\u0442\u0438\u044f \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e, \u043e \u0447\u0451\u043c \u043c\u0435\u0447\u0442\u0430\u043b \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<br \/>  \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043e\u043d \u0432 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiviewcontrollertransitioningdelegate\">\u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u0441\u0432\u0438\u0442\u043a\u0430\u0445<\/a> \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u043b\u044f\u0442\u0438\u0435 \u0438 \u043d\u0430\u0447\u0430\u043b \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f.<br \/>  \u0417\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0435\u0431\u0435 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0443 \u0441 \u0441\u0430\u043c\u0438\u043c \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code>extension VCYellow: UIViewControllerTransitioningDelegate {     func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -&gt; UIViewControllerAnimatedTransitioning? {         return AnimatorPresent(startFrame: self.startFrame)     }      func animationController(forDismissed dismissed: UIViewController) -&gt; UIViewControllerAnimatedTransitioning? {         return AnimatorDismiss(endFrame: self.startFrame)     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0435\u0439 \u043e\u043d \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440 <em>AnimatorPresent<\/em>, \u0430 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 <em>AnimatorDismiss<\/em>.<br \/>  \u041d\u0443 \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0431\u043e\u0438\u043c \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440\u0430\u043c \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0438\u0437 <em>VCMain<\/em><\/p>\n<p>  <\/p>\n<p>\u0410 \u043f\u043e\u0442\u043e\u043c \u0438 \u0441\u0430\u043c \u043c\u043e\u0440\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0441\u044f. \u041f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u044f, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u0438\u043a\u0430\u043a\u0430\u044f \u043c\u0430\u0433\u0438\u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code>override func viewDidLoad() {     super.viewDidLoad()     self.modalPresentationStyle = .custom     self.transitioningDelegate = self }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u043e\u043d \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u0430 <em>VCMain<\/em> \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u043d\u0443\u0442\u044c \u0441\u0435\u0431\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u0430\u0433\u0438\u044f \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u2026 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043e\u043d\u0430 \u043d\u0438\u043a\u0430\u043a\u2026<br \/>  \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e AnimatorPresent \u0438 AnimatorDismiss \u0441\u0430\u043c\u0438 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u044b\u043b\u043e \u0443\u0436\u0435 \u043f\u043e\u0437\u0434\u043d\u043e \u0438 \u043d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440\u044b. \u041f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u043b\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiviewcontrolleranimatedtransitioning\">\u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u0441\u0432\u0438\u0442\u043a\u043e\u0432<\/a> \u0438 \u0443\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0432\u0443\u0445 \u0432\u0435\u0449\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0430\u0434\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043e\u0442\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code>func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -&gt; TimeInterval {     return 0.3 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0441\u0430\u043c\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code> func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {     \/\/1     guard let vcTo = transitionContext.viewController(forKey: .to),         let snapshot = vcTo.view.snapshotView(afterScreenUpdates: true) else {         return     }      \/\/2     let vContainer = transitionContext.containerView      \/\/3     vcTo.view.isHidden = true     vContainer.addSubview(vcTo.view)      \/\/4     snapshot.frame = self.startFrame     vContainer.addSubview(snapshot)      UIView.animate(withDuration: 0.3, animations: {         \/\/5         snapshot.frame = (transitionContext.finalFrame(for: vcTo))     }, completion: { success in         \/\/6         vcTo.view.isHidden = false         snapshot.removeFromSuperview()         transitionContext.completeTransition(true)     }) } <\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0412\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0443\u0435\u043c\u044b\u0439 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440(\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 VCYellow) \u0438 \u0441\u0444\u043e\u0442\u043a\u0430\u0442\u044c \u0435\u0433\u043e. \u0424\u043e\u0442\u043a\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u044c\u044e\u0448\u043a\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0434\u0443\u043d\u0441\u0442\u0432\u043e. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0451 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/li>\n<li>\u041d\u0430\u0446\u0435\u043f\u0438\u0442\u044c \u0432\u044c\u044e\u0445\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438 \u0441\u043a\u0440\u044b\u0442\u044c \u0435\u0451. \u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c<\/li>\n<li>\u0435\u0451 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f.<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u043e\u0442\u043a\u0443 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438. \u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0438 \u043a\u0438\u043d\u0443\u0442\u044c \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/li>\n<li>\u0420\u0430\u0441\u0449\u0435\u043f\u0435\u0440\u0438\u0442\u044c \u0444\u043e\u0442\u043a\u0443 \u043d\u0430 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0432\u044c\u044e\u0445\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430,<\/li>\n<li>\u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0444\u043e\u0442\u043a\u0438 \u0438 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u043e \u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043e.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0448\u0435\u043b \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430:<\/p>\n<p>  <\/p>\n<pre><code>import UIKit  class AnimatorPresent: NSObject, UIViewControllerAnimatedTransitioning {     let startFrame: CGRect      init(startFrame: CGRect) {         self.startFrame = startFrame     }      func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -&gt; TimeInterval {         return 0.3     }      func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {         guard let vcTo = transitionContext.viewController(forKey: .to),         let snapshot = vcTo.view.snapshotView(afterScreenUpdates: true) else {             return         }          let vContainer = transitionContext.containerView          vcTo.view.isHidden = true         vContainer.addSubview(vcTo.view)          snapshot.frame = self.startFrame         vContainer.addSubview(snapshot)          UIView.animate(withDuration: 0.3, animations: {             snapshot.frame = (transitionContext.finalFrame(for: vcTo))         }, completion: { success in             vcTo.view.isHidden = false             snapshot.removeFromSuperview()             transitionContext.completeTransition(true)         })     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442:<\/p>\n<p>  <\/p>\n<pre><code>import UIKit  class AnimatorDismiss: NSObject, UIViewControllerAnimatedTransitioning {      let endFrame: CGRect      init(endFrame: CGRect) {         self.endFrame = endFrame     }      func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -&gt; TimeInterval {         return 0.3     }      func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {         guard let vcTo = transitionContext.viewController(forKey: .to),         let vcFrom = transitionContext.viewController(forKey: .from),         let snapshot = vcFrom.view.snapshotView(afterScreenUpdates: true) else {             return         }          let vContainer = transitionContext.containerView         vContainer.addSubview(vcTo.view)         vContainer.addSubview(snapshot)          vcFrom.view.isHidden = true          UIView.animate(withDuration: 0.3, animations: {             snapshot.frame = self.endFrame         }, completion: { success in             transitionContext.completeTransition(true)         })     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043a\u043e\u043d\u0447\u0438\u0432 \u0432\u0441\u0435 \u0434\u043e\u0434\u0435\u043b\u043a\u0438, <em>VCYellow<\/em> \u043e\u043f\u044f\u0442\u044c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u0430 <em>VCMain<\/em> \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0438 \u043e \u0447\u0443\u0434\u043e!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ev\/c7\/oz\/evc7ozq2dgznnwbm0h9mry7brko.gif\"\/><\/p>\n<p>  <\/p>\n<p>\u041c\u0430\u0433\u0438\u044f \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430! \u041c\u0435\u0447\u0442\u0430 <em>VCYellow<\/em> \u0441\u0431\u044b\u043b\u0430\u0441\u044c! \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0435\u043c\u0443 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438 \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u044e!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442-\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"https:\/\/github.com\/funkydevil\/customTransition\">\u0442\u0443\u0442<\/a><\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u043b\u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/www.raywenderlich.com\/322-custom-uiviewcontroller-transitions-getting-started\">\u0442\u0443\u0442<\/a><\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/424853\/\"> https:\/\/habr.com\/post\/424853\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u0416\u0438\u043b \u0431\u044b\u043b \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0439 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <em>VCYellow<\/em>. \u0418 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443 \u043d\u0435\u0433\u043e \u043d\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u043d\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u0438 \u0434\u0430\u0436\u0435 \u043c\u0430\u043b\u044e\u0441\u0435\u043d\u044c\u043a\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438. \u0416\u0438\u043b \u043e\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0432\u044c\u044e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0441\u043a\u043e\u0439 \u0436\u0438\u0437\u043d\u044c\u044e.<\/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-290095","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290095","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=290095"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290095\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}