in the majority of iOS apps. Required delegate methods include: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int Your app may crash and your tableview will be useless if you fail to implement these methods.
to use the object? 1) Our map 2) To populate data for our table view cells 3) In our detail view when a user taps on a table view cell 4) In our favorites view controller for favoriting locations 5) In our global singleton (sparingly)
you put here. The view hasn’t been laid out yet. 2) yourView.someProperty = someValue. In the setter, subviews are often initialized. 3) viewDidLoad. The view is loaded into memory via presentViewController or pushViewController or setViewControllers. 4) viewWillAppear. For code you want executed every time the controller is atop the window hierarchy. 5) viewWillLayoutSubviews. Typically set frames here as this gets called when the device orientation changes amongst other events (e.g. when a table is reloaded). 6) viewDidAppear. Put animation code here to ensure that the animation block fires and to ensure that the user doesn’t see the view after the animation has begun.
dummy JSON file for our datasource. Data, Bundle, and JSONSerialization are all subclasses of NSObject. Get familiar with the class methods shown here. They’re used often for converting data from the filesystem or some other source into Swift code.