Files
swift-mirror/stdlib/public/Darwin/MapKit/NSValue.swift.gyb
Saleem Abdulrasool 41d9c2cc59 stdlib: restructure for OS family layout of SDK overlay
The SDK directory is now confusing as the Windows target also has a SDK
overlay.  In order to make this more uniform, move the SDK directory to
Darwin which covers the fact that this covers the XNU family of OSes.
The Windows directory contains the SDK overlay for the Windows target.
2018-12-06 11:32:05 -08:00

37 lines
1.1 KiB
Swift

@_exported import MapKit // Clang module
import Foundation
%{
from gyb_foundation_support import \
ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods
}%
// Get the ObjC type used by -[NSValue valueWithMKCoordinateSpan:]
// to instantiate the resulting NSValue objects, in case these get changed
// in the future.
@available(tvOS 9.2, *)
private let MKCoordinateSpanInNSValueObjCType =
NSValue(mkCoordinateSpan: .init()).objCType
${ ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods(
Type="MKCoordinateSpan",
initializer="""{
guard #available(tvOS 9.2, *) else {
fatalError("MKCoordinateSpan is not supported on tvOS before tvOS 9.2")
}
return NSValue(mkCoordinateSpan: $0)
}""",
getter="""{
guard #available(tvOS 9.2, *) else {
fatalError("MKCoordinateSpan is not supported on tvOS before tvOS 9.2")
}
return $0.mkCoordinateSpanValue
}""",
objCType="""{ _ in
guard #available(tvOS 9.2, *) else {
fatalError("MKCoordinateSpan is not supported on tvOS before tvOS 9.2")
}
return MKCoordinateSpanInNSValueObjCType
}""",
) }