-
Notifications
You must be signed in to change notification settings - Fork 1
/
AnnotationModel.swift
49 lines (32 loc) · 1012 Bytes
/
AnnotationModel.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// AnnotationModel.swift
// SwissKnife
//
// Created by Robert on 2018-04-19.
// Copyright © 2018 Georgios. All rights reserved.
//
import MapKit
import Contacts
class AnnotationModel: NSObject, MKAnnotation {
let title: String?
let locationName: String
let dicipline: String
let coordinate: CLLocationCoordinate2D
init(title: String, locationName: String, dicipline: String, coordinate: CLLocationCoordinate2D) {
self.title = title
self.locationName = locationName
self.dicipline = dicipline
self.coordinate = coordinate
super.init()
}
var subtitle: String? {
return locationName
}
func mapItem() -> MKMapItem {
let addressDict = [CNPostalAddressStreetKey: subtitle!]
let placemark = MKPlacemark(coordinate: coordinate, addressDictionary: addressDict)
let mapItem = MKMapItem(placemark: placemark)
mapItem.name = title
return mapItem
}
}