Chapter 6, page 105 - Obsolete Code

#1

The code shown in the book is listed as deprecated
.
segmentedControl.addTarget(self, action: “mapTypeChanged:”, forControlEvents: .ValueChanged)

should be replaced by

segmentedControl.addTarget(self, action: #selector(MapViewController.mapTypeChanged(_:)), forControlEvents: .ValueChanged)

Xcode 7.3.1 suggests the fix which does work.

#2

This code does the job
segmentedControl.addTarget(self,
action: #selector(MapViewController.mapTypeChanged),
for: .valueChanged)