TKRegionManager
public class TKRegionManager : NSObject
Undocumented
-
Undocumented
Declaration
Swift
public static let shared: TKRegionManager
-
loadRegionsFromCache()
AsynchronousUndocumented
Declaration
Swift
@MainActor public func loadRegionsFromCache() async
-
Undocumented
Declaration
Swift
public var hasRegions: Bool { get }
-
Undocumented
Declaration
Swift
public var regions: [TKRegion] { get }
-
Undocumented
Declaration
Swift
public func modeDetails(forModeIdentifier mode: String) -> TKAPI.ModeDetails?
-
Undocumented
Declaration
Swift
public var regionsHash: NSNumber? { get }
-
requireRegion(for:
Asynchronous, from TripKit) Undocumented
Declaration
Swift
@MainActor public func requireRegion(for coordinate: CLLocationCoordinate2D) async throws -> TKRegion
-
requireRegion(for:
Asynchronous, from TripKit) Undocumented
Declaration
Swift
@MainActor public func requireRegion(for coordinateRegion: MKCoordinateRegion) async throws -> TKRegion
-
coordinateIsPartOfAnyRegion(_:
From TripKit) Undocumented
Declaration
Swift
public func coordinateIsPartOfAnyRegion(_ coordinate: CLLocationCoordinate2D) -> Bool
-
mapRectIntersectsAnyRegion(_:
From TripKit) Used to check if user can route in that area.
Declaration
Swift
public func mapRectIntersectsAnyRegion(_ mapRect: MKMapRect) -> Bool
-
region(containing:
From TripKit) Declaration
Swift
public func region(containing region: MKCoordinateRegion) -> TKRegion
Return Value
A matching local region or the shared instance of
TKInternationalRegion
if no local region contains this coordinate region. -
localRegions(overlapping:
From TripKit) Declaration
Swift
public func localRegions(overlapping region: MKCoordinateRegion) -> [TKRegion]
Return Value
Local regions that overlap with the provided coordinate region. Can be empty.
-
localRegions(start:
From TripKitend: ) Determines the local (non-international) regions for the coordinate pair
Declaration
Swift
public func localRegions(start: CLLocationCoordinate2D, end: CLLocationCoordinate2D) -> [TKRegion]
Parameters
start
A valid coordinate
end
Another valid coordinate
Return Value
An array of either A) no element (if both coordinates are in the international region), B) one element (if both coordinates are in the the same region, or C) two elements (a local region for the start and one for the end coordinates).
-
localRegions(containing:
From TripKit) Declaration
Swift
public func localRegions(containing coordinate: CLLocationCoordinate2D) -> Set<TKRegion>
Parameters
coordinate
A coordinate
Return Value
The local (non-international) regions intersecting with the provided coordinate
-
region(containing:
From TripKit_: ) Determines a region (local or international) for the coordinate pair
Declaration
Swift
public func region(containing first: CLLocationCoordinate2D, _ second: CLLocationCoordinate2D) -> TKRegion
Parameters
first
A valid coordinate
second
Another valid coordinate
Return Value
A local region if both lie within the same or the shared international region instance.
-
timeZone(for:
From TripKit) Declaration
Swift
public func timeZone(for coordinate: CLLocationCoordinate2D) -> TimeZone?
Parameters
coordinate
A valid coordinate
Return Value
The time zone of a matching region for this coordinate. Will return
nil
if the coordinate falls outside any supported region. -
city(nearestTo:
From TripKit) Find city closest to provided coordinate, in same region
Declaration
Swift
public func city(nearestTo target: CLLocationCoordinate2D) -> TKRegion.City?
Parameters
target
Coordinate for which to find closest city
Return Value
Nearest City
-
remoteImageIsTemplate(forModeIdentifier:
From TripKit) Undocumented
Declaration
Swift
public func remoteImageIsTemplate(forModeIdentifier mode: String) -> Bool
-
remoteImageIsBranding(forModeIdentifier:
From TripKit) Undocumented
Declaration
Swift
public func remoteImageIsBranding(forModeIdentifier mode: String) -> Bool
-
imageURL(forModeIdentifier:
From TripKiticonType: ) Undocumented
Declaration
Swift
public func imageURL(forModeIdentifier mode: String?, iconType: TKStyleModeIconType) -> URL?
-
sortedModes(in:
From TripKit)
-
Undocumented
Declaration
Swift
public static var cacheURL: URL { get }
-
Undocumented
Declaration
Swift
public static func readLocalCache() -> Data?
-
Undocumented
Declaration
Swift
public static func saveToCache(_ data: Data)
-
Declaration
Swift
public func title(forModeIdentifier mode: String) -> String?
Parameters
mode
The mode identifier for which you want the title
Return Value
The localized title as defined by the server
-
Declaration
Swift
public func subtitle(forModeIdentifier mode: String) -> String?
Parameters
mode
The mode identifier for which you want the title
Return Value
The localized subtitle as defined by the server
-
Declaration
Swift
public func websiteURL(forModeIdentifier mode: String) -> URL?
Parameters
mode
The mode identifier for which you want the official website URL
Return Value
The URL as defined by the server
-
Declaration
Swift
public func color(forModeIdentifier mode: String) -> TKColor?
Parameters
mode
The mode identifier for which you want the official color
Return Value
The color as defined by the server
-
Declaration
Swift
public func modeIdentifierIsRequired(_ mode: String) -> Bool
Return Value
If specified mode identifier is required and can’t get disabled.
-
Declaration
Swift
public func impliedModes(byModeIdentifer mode: String) -> [String]
Return Value
List of modes that this mode implies, i.e., enabling the specified modes should also enable all the returned modes.
-
Declaration
Swift
public func dependentModeIdentifier(forModeIdentifier mode: String) -> [String]
Return Value
List of modes that are dependent on this mode, i.e., disabling this mode should also disable all the returned modes.
-
Declaration
Swift
@available(*, deprecated, renamed: "localRegion(code:﹚") public func localRegion(named name: String) -> TKRegion?
Parameters
name
A region code
Return Value
The local (non-international) region matching the provided code
-
Declaration
Swift
public func localRegion(code: String) -> TKRegion?
Parameters
code
A region code
Return Value
The local (non-international) region matching the provided code
-
Fetched the list of regions and updates
TKRegionManager
‘s cacheEquivalent to
updateRegions(forced:) async throws
, but ignores the error.Recommended to call from the application delegate.
Declaration
Swift
public func updateRegions(forced: Bool = false)
Parameters
forced
Set true to force overwriting the internal cache
-
Undocumented
Declaration
Swift
public func requireRegions(completion: @escaping (Result<Void, Error>) -> Void)
-
requireRegions()
AsynchronousUndocumented
Declaration
Swift
@MainActor public func requireRegions() async throws
-
fetchRegions(forced:
Asynchronous) Fetched the list of regions and updates
TKRegionManager
‘s cacheEquivalent to
updateRegions(forced:)
.Recommended to call from the application delegate.
Declaration
Swift
@MainActor public func fetchRegions(forced: Bool) async throws
Parameters
forced
Set true to force overwriting the internal cache