How to do it...

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

Get iOS Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.