April 2020
Beginner
316 pages
8h 20m
English
We'll start by heading on over to MapHelper.swift, where we'll create a new class called AnnotationPin. This class will be a custom subclass of MKAnnotation. We're creating a subclass as we'd like to customize the annotation later on.
Add the following at the footer of our MapHelper.swift for now:
class AnnotationPin: NSObject, MKAnnotation { let title: String? let subtitle: String? let coordinate: CLLocationCoordinate2D init(title: String?, subtitle: String?, coordinate: CLLocationCoordinate2D) { self.title = title self.subtitle = subtitle self.coordinate = coordinate }}
The preceding is a basic subclass of MKAnnotation. We've even overwritten the base properties of title, subtitle, and coordinate
Read now
Unlock full access