UserLocations
public struct UserLocations
Entity holding all personal locations of the current user of the application.
All modifications to the personal locations must be persisted using PersonalData.storeUserProfile.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Errors related to
UserLocations.See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum Error : Swift.Error -
The user’s home location.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var home: PersonalLocation? { get } -
The user’s work location.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var work: PersonalLocation? { get } -
The user’s favorite locations.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var favorites: [PersonalLocation] { get } -
The recent destinations of the user, ordered with the most recent one first.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var recentDestinations: [PersonalLocation] { get } -
Checks whether this place is associated with any personal locations.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func findLocations(with place: Place) -> [PersonalLocation]Parameters
placeThe place for which to find the personal location.
Return Value
The personal locations matching the given place, an empty array if no such location exists.
-
Find a personal location by its identifier.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func findLocation(with id: UUID) -> PersonalLocation?Parameters
idThe identifier of the personal location to find.
Return Value
The personal location for the given id or
nilif no such location exists. -
Creates a new personal location with the given types. The new personal location is assigned to the respective property of the user locations and returned.
Throws
UserLocations.Error.typesSetIsEmptyif an empty set of types has been passed.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
@discardableResult public mutating func create( types: Set<PersonalLocation.`Type`>, place: Place, name: String = "", hasPrivateCharger: Bool = false ) throws -> PersonalLocationParameters
typesThe types of the personal location. Is required to be non-empty, otherwise the method throws a
UserLocations.Error.typesSetIsEmptyerror.placeThe place for which a personal location is created.
nameThe name of the personal location.
hasPrivateChargerWhether the personal location has a private charger.
Return Value
The newly created personal location.
-
Updates the given personal location with the new types.
Throws
UserLocations.Error.typesSetIsEmptyif an empty set of types has been passed.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
@discardableResult public mutating func update( location: PersonalLocation, types: Set<PersonalLocation.`Type`> ) throws -> BoolParameters
locationThe personal location to update.
typesThe new types for the personal location. It is required to be non-empty, otherwise the method throws a
UserLocations.Error.typesSetIsEmpty.Return Value
True if the location was updated, false if the location was not found.
-
Removes the given personal location.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
@discardableResult public mutating func remove(location: PersonalLocation) -> BoolParameters
locationThe personal location to remove.
Return Value
True if the location was removed, false if the location was not found.
TomTom SDK for iOS (0.54.0)
UserLocations