Created
June 21, 2020 10:22
-
-
Save aryasurya21/261e6923e922d1080d2700cd5b6b6ede to your computer and use it in GitHub Desktop.
Final version of HomeViewController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class HomeViewController: UIViewController { | |
@IBOutlet weak var containerView: UIView! | |
private let checkInController: CheckInViewController | |
private let checkOutController: CheckOutViewController | |
init(){ | |
self.checkInController = CheckInViewController() | |
self.checkOutController = CheckOutViewController() | |
super.init(nibName: nil, bundle: nil) | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
private func switchContentController(_ destinationVC: UIViewController){ | |
destinationVC.view.frame = CGRect( | |
x: 0, | |
y: 0, | |
width: self.containerView.frame.width, | |
height: self.containerView.frame.height | |
) | |
self.containerView.addSubview(destinationVC.view) | |
} | |
@IBAction func tappedCheckIn(_ sender: Any){ | |
self.switchContentController(self.checkInController) | |
} | |
@IBAction func tappedCheckOut(_ sender: Any){ | |
self.switchContentController(self.checkOutController) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment