- Create a new Xcode project with the Master-Detail Application template and with name MemoryManagement. Check out the following screenshot:
- The new project will be created with sample code for a master-detail template app. Open the source file DetailViewController.swift.
- Add the following class at the top of the file:
class Child{ var parent: UIViewController? }
- Then, in the DetailViewController class, add the following property:
let child = Child()
- Update the viewDidLoad function like this:
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. ...