Documentation Archive Developer
Search

MapKit Changes for Swift

MapKit

DeclarationProtocols
From
class MKDistanceFormatter : NSFormatter {
    func stringFromDistance(_ distance: CLLocationDistance) -> String
    func distanceFromString(_ distance: String) -> CLLocationDistance
    @NSCopying var locale: NSLocale!
    var units: MKDistanceFormatterUnits
    var unitStyle: MKDistanceFormatterUnitStyle
}
--
To
class MKDistanceFormatter : Formatter {
    func string(fromDistance distance: CLLocationDistance) -> String
    func distance(from distance: String) -> CLLocationDistance
    var locale: Locale!
    var units: MKDistanceFormatterUnits
    var unitStyle: MKDistanceFormatterUnitStyle
    enum Context : Int {
        case unknown
        case dynamic
        case standalone
        case listItem
        case beginningOfSentence
        case middleOfSentence
    }
    enum UnitStyle : Int {
        case short
        case medium
        case long
    }
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool)
    func performSelector(inBackground aSelector: Selector, with arg: Any?)
    class func classForKeyedUnarchiver() -> AnyClass
    var classForKeyedArchiver: AnyClass? { get }
    func replacementObject(for archiver: NSKeyedArchiver) -> Any?
    class func classFallbacksForKeyedArchiver() -> [String]
    class func keyPathsForValuesAffectingValue(forKey key: String) -> Set<String>
    class func automaticallyNotifiesObservers(forKey key: String) -> Bool
    var observationInfo: UnsafeMutableRawPointer?
    func willChangeValue(forKey key: String)
    func didChangeValue(forKey key: String)
    func willChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func didChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func willChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func didChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options options: NSKeyValueObservingOptions = [], context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String, context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String)
    func observeValue(forKeyPath keyPath: String?, of object: Any?, change change: [NSKeyValueChangeKey : Any]?, context context: UnsafeMutableRawPointer?)
    class var accessInstanceVariablesDirectly: Bool { get }
    func value(forKey key: String) -> Any?
    func setValue(_ value: Any?, forKey key: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey inKey: String) throws
    func mutableArrayValue(forKey key: String) -> NSMutableArray
    func mutableOrderedSetValue(forKey key: String) -> NSMutableOrderedSet
    func mutableSetValue(forKey key: String) -> NSMutableSet
    func value(forKeyPath keyPath: String) -> Any?
    func setValue(_ value: Any?, forKeyPath keyPath: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKeyPath inKeyPath: String) throws
    func mutableArrayValue(forKeyPath keyPath: String) -> NSMutableArray
    func mutableOrderedSetValue(forKeyPath keyPath: String) -> NSMutableOrderedSet
    func mutableSetValue(forKeyPath keyPath: String) -> NSMutableSet
    func value(forUndefinedKey key: String) -> Any?
    func setValue(_ value: Any?, forUndefinedKey key: String)
    func setNilValueForKey(_ key: String)
    func dictionaryWithValues(forKeys keys: [String]) -> [String : Any]
    func setValuesForKeys(_ keyedValues: [String : Any])
    func fileManager(_ fm: FileManager, shouldProceedAfterError errorInfo: [AnyHashable : Any]) -> Bool
    func fileManager(_ fm: FileManager, willProcessPath path: String)
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval, inModes modes: [RunLoopMode])
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any, selector aSelector: Selector, object anArgument: Any?)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int, delegate delegate: Any?, didRecoverSelector didRecoverSelector: Selector?, contextInfo contextInfo: UnsafeMutableRawPointer?)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int) -> Bool
    var autoContentAccessingProxy: Any { get }
    class func version() -> Int
    class func setVersion(_ aVersion: Int)
    var classForCoder: AnyClass { get }
    func awakeAfter(using aDecoder: NSCoder) -> Any?
}
extension MKDistanceFormatter : CVarArg {
}
extension MKDistanceFormatter : Equatable, Hashable {
    var hashValue: Int { get }
}
CVarArg, Equatable, Hashable

Declaration
From
func distanceFromString(_ distance: String) -> CLLocationDistance
To
func distance(from distance: String) -> CLLocationDistance

Declaration
From
@NSCopying var locale: NSLocale!
To
var locale: Locale!

Declaration
From
func stringFromDistance(_ distance: CLLocationDistance) -> String
To
func string(fromDistance distance: CLLocationDistance) -> String

Declaration
From
enum MKDistanceFormatterUnits : UInt {
    case Default
    case Metric
    case Imperial
    case ImperialWithYards
}
To
enum MKDistanceFormatterUnits : UInt {
    case `default`
    case metric
    case imperial
    case imperialWithYards
}

Declaration
From
case Default
To
case `default`

Declaration
From
case Imperial
To
case imperial

Declaration
From
case ImperialWithYards
To
case imperialWithYards

Declaration
From
case Metric
To
case metric

Declaration
From
enum MKDistanceFormatterUnitStyle : UInt {
    case Default
    case Abbreviated
    case Full
}
To
enum MKDistanceFormatterUnitStyle : UInt {
    case `default`
    case abbreviated
    case full
}

Declaration
From
case Abbreviated
To
case abbreviated

Declaration
From
case Default
To
case `default`

Declaration
From
case Full
To
case full

Modified MKMapItem
DeclarationProtocols
From
class MKMapItem : NSObject {
    var placemark: MKPlacemark { get }
    var isCurrentLocation: Bool { get }
    var name: String?
    var phoneNumber: String?
    var url: NSURL?
    @NSCopying var timeZone: NSTimeZone?
    class func mapItemForCurrentLocation() -> MKMapItem
    init(placemark placemark: MKPlacemark)
    func openInMapsWithLaunchOptions(_ launchOptions: [String : AnyObject]?) -> Bool
    class func openMapsWithItems(_ mapItems: [MKMapItem], launchOptions launchOptions: [String : AnyObject]?) -> Bool
}
--
To
class MKMapItem : NSObject {
    var placemark: MKPlacemark { get }
    var isCurrentLocation: Bool { get }
    var name: String?
    var phoneNumber: String?
    var url: URL?
    var timeZone: TimeZone?
    class func forCurrentLocation() -> MKMapItem
    init(placemark placemark: MKPlacemark)
    func openInMaps(launchOptions launchOptions: [String : Any]? = nil) -> Bool
    class func openMaps(with mapItems: [MKMapItem], launchOptions launchOptions: [String : Any]? = nil) -> Bool
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func performSelector(onMainThread aSelector: Selector, with arg: Any?, waitUntilDone wait: Bool)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool, modes array: [String]?)
    func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, waitUntilDone wait: Bool)
    func performSelector(inBackground aSelector: Selector, with arg: Any?)
    class func classForKeyedUnarchiver() -> AnyClass
    var classForKeyedArchiver: AnyClass? { get }
    func replacementObject(for archiver: NSKeyedArchiver) -> Any?
    class func classFallbacksForKeyedArchiver() -> [String]
    class func keyPathsForValuesAffectingValue(forKey key: String) -> Set<String>
    class func automaticallyNotifiesObservers(forKey key: String) -> Bool
    var observationInfo: UnsafeMutableRawPointer?
    func willChangeValue(forKey key: String)
    func didChangeValue(forKey key: String)
    func willChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func didChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
    func willChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func didChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
    func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options options: NSKeyValueObservingOptions = [], context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String, context context: UnsafeMutableRawPointer?)
    func removeObserver(_ observer: NSObject, forKeyPath keyPath: String)
    func observeValue(forKeyPath keyPath: String?, of object: Any?, change change: [NSKeyValueChangeKey : Any]?, context context: UnsafeMutableRawPointer?)
    class var accessInstanceVariablesDirectly: Bool { get }
    func value(forKey key: String) -> Any?
    func setValue(_ value: Any?, forKey key: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey inKey: String) throws
    func mutableArrayValue(forKey key: String) -> NSMutableArray
    func mutableOrderedSetValue(forKey key: String) -> NSMutableOrderedSet
    func mutableSetValue(forKey key: String) -> NSMutableSet
    func value(forKeyPath keyPath: String) -> Any?
    func setValue(_ value: Any?, forKeyPath keyPath: String)
    func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKeyPath inKeyPath: String) throws
    func mutableArrayValue(forKeyPath keyPath: String) -> NSMutableArray
    func mutableOrderedSetValue(forKeyPath keyPath: String) -> NSMutableOrderedSet
    func mutableSetValue(forKeyPath keyPath: String) -> NSMutableSet
    func value(forUndefinedKey key: String) -> Any?
    func setValue(_ value: Any?, forUndefinedKey key: String)
    func setNilValueForKey(_ key: String)
    func dictionaryWithValues(forKeys keys: [String]) -> [String : Any]
    func setValuesForKeys(_ keyedValues: [String : Any])
    func fileManager(_ fm: FileManager, shouldProceedAfterError errorInfo: [AnyHashable : Any]) -> Bool
    func fileManager(_ fm: FileManager, willProcessPath path: String)
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval, inModes modes: [RunLoopMode])
    func perform(_ aSelector: Selector, with anArgument: Any?, afterDelay delay: TimeInterval)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any, selector aSelector: Selector, object anArgument: Any?)
    class func cancelPreviousPerformRequests(withTarget aTarget: Any)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int, delegate delegate: Any?, didRecoverSelector didRecoverSelector: Selector?, contextInfo contextInfo: UnsafeMutableRawPointer?)
    func attemptRecovery(fromError error: Error, optionIndex recoveryOptionIndex: Int) -> Bool
    var autoContentAccessingProxy: Any { get }
    class func version() -> Int
    class func setVersion(_ aVersion: Int)
    var classForCoder: AnyClass { get }
    func awakeAfter(using aDecoder: NSCoder) -> Any?
}
extension MKMapItem : CVarArg {
}
extension MKMapItem : Equatable, Hashable {
    var hashValue: Int { get }
}
CVarArg, Equatable, Hashable

Declaration
From
class func mapItemForCurrentLocation() -> MKMapItem
To
class func forCurrentLocation() -> MKMapItem

Declaration
From
func openInMapsWithLaunchOptions(_ launchOptions: [String : AnyObject]?) -> Bool
To
func openInMaps(launchOptions launchOptions: [String : Any]? = nil) -> Bool

Declaration
From
class func openMapsWithItems(_ mapItems: [MKMapItem], launchOptions launchOptions: [String : AnyObject]?) -> Bool
To
class func openMaps(with mapItems: [MKMapItem], launchOptions launchOptions: [String : Any]? = nil) -> Bool

Declaration
From
@NSCopying var timeZone: NSTimeZone?
To
var timeZone: TimeZone?

Modified MKMapItem.url
Declaration
From
var url: NSURL?
To
var url: URL?

Modified MKPlacemark
Declaration
From
class MKPlacemark : CLPlacemark, MKAnnotation {
    init(coordinate coordinate: CLLocationCoordinate2D, addressDictionary addressDictionary: [String : AnyObject]?)
    var countryCode: String? { get }
}
To
class MKPlacemark : CLPlacemark, MKAnnotation {
    init(coordinate coordinate: CLLocationCoordinate2D)
    init(coordinate coordinate: CLLocationCoordinate2D, addressDictionary addressDictionary: [String : Any]?)
    init(coordinate coordinate: CLLocationCoordinate2D, postalAddress postalAddress: CNPostalAddress)
    var countryCode: String? { get }
}

Declaration
From
init(coordinate coordinate: CLLocationCoordinate2D, addressDictionary addressDictionary: [String : AnyObject]?)
To
init(coordinate coordinate: CLLocationCoordinate2D, addressDictionary addressDictionary: [String : Any]?)

Declaration
From
init(MKCoordinate coordinate: CLLocationCoordinate2D)
To
init(mkCoordinate coordinate: CLLocationCoordinate2D)

Declaration
From
init(MKCoordinateSpan span: MKCoordinateSpan)
To
init(mkCoordinateSpan span: MKCoordinateSpan)

Declaration
From
var MKCoordinateSpanValue: MKCoordinateSpan { get }
To
var mkCoordinateSpanValue: MKCoordinateSpan { get }

Declaration
From
var MKCoordinateValue: CLLocationCoordinate2D { get }
To
var mkCoordinateValue: CLLocationCoordinate2D { get }