No Description

ResearchContainerSegue.swift 942B

123456789101112131415161718192021222324252627282930
  1. //
  2. // ResearchContainerSegue.swift
  3. // EncuestaMarle
  4. //
  5. // Created by Tatiana Castro on 5/20/19.
  6. // Copyright © 2019 Marle. All rights reserved.
  7. //
  8. import UIKit
  9. class ResearchContainerSegue: UIStoryboardSegue {
  10. override func perform() {
  11. let controllerToReplace = source.children.first
  12. let destinationControllerView = destination.view
  13. destinationControllerView?.translatesAutoresizingMaskIntoConstraints = true
  14. destinationControllerView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  15. destinationControllerView?.frame = source.view.bounds
  16. controllerToReplace?.willMove(toParent: nil)
  17. source.addChild(destination)
  18. source.view.addSubview(destinationControllerView!)
  19. controllerToReplace?.view.removeFromSuperview()
  20. destination.didMove(toParent: source)
  21. controllerToReplace?.removeFromParent()
  22. }
  23. }