TravelKit
@interface TravelKit : NSObject
The main class currently used for authentication and data fetching. It provides a singleton
instance with the public +sharedKit
method which may be used to work with the Travel
backend.
The basic workflow is pretty straightforward – to start using TravelKit, you only need a couple of lines to get the desired data.
// Get shared instance
TravelKit *kit = [TravelKit sharedKit];
// Set your API key
kit.APIKey = @"<YOUR_API_KEY_GOES_HERE>";
// Ask kit for Eiffel Tower TKDetailedPlace object with details
[kit.places detailedPlaceWithID:@"poi:530" completion:^(TKDetailedPlace *place, NSError *e) {
if (place) NSLog(@"Let's visit %@!", place.name);
else NSLog(@"Something went wrong :/");
}];
// Use shared instance to set your API key
TravelKit.shared.apiKey = "<YOUR_API_KEY_GOES_HERE>"
// Ask TKPlaceManager for Eiffel Tower TKDetailedPlace object with details
TravelKit.shared.places.detailedPlace(withID: "poi:530") { (place, e) in
if let place = place {
print("Let's visit \(place.name)")
}
else {
print("Something went wrong :/")
}
}
Warning
API key must be provided, otherwise using any methods listed above will result in an error being returned in a call completion block.-
Shared singleton object to work with.
Warning
Regular-init
and+new
methods are not available.Declaration
Objective-C
@property (readonly, strong, atomic, class) TravelKit *_Nonnull sharedKit;
Swift
class var shared: TravelKit { get }
-
Client API key you’ve obtained.
Warning
This needs to be set in order to perform static data requests successfully.Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSString *APIKey;
Swift
var apiKey: String? { get set }
-
Client ID key you’ve obtained.
Warning
This needs to be set in order to perform user-specific data requests successfully.Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSString *clientID;
Swift
var clientID: String? { get set }
-
Preferred language of response data to use.
Note
Supported language codes:en
,fr
,de
,es
,nl
,pt
,it
,ru
,cs
,sk
,pl
,tr
,zh
,ko
,ar
,da
,el
,fi
,he
,hu
,no
,ro
,sv
,th
,uk
.Default language code is
en
.If you want to enforce specific language or pick the one depending on your own choice, simply set one of the options listed.
Warning
This needs to be set in order to receive translated content.Declaration
Objective-C
@property (readwrite, copy, nonatomic, null_resettable) NSString *language;
Swift
var language: String! { get set }
-
Shared Place Manager instance to provide Places-related stuff.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKPlacesManager *_Nonnull places;
Swift
var places: TKPlacesManager { get }
-
Shared Trips Manager instance to provide Trips-related stuff.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKTripsManager *_Nonnull trips;
Swift
var trips: TKTripsManager { get }
-
Shared Trips Manager instance to provide Trips-related stuff.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKFavoritesManager *_Nonnull favorites;
Swift
var favorites: TKFavoritesManager { get }
-
Shared Tours Manager instance to provide Tours-related stuff.
Warning
Experimental.Declaration
Objective-C
@property (readonly, strong, nonatomic) TKToursManager *_Nonnull _tours;
Swift
var _tours: TKToursManager { get }
-
Shared Session Manager instance to provide Session-related stuff.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKSessionManager *_Nonnull session;
Swift
var session: TKSessionManager { get }
-
Shared Synchronization Manager instance to provide Sync-related stuff.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKSynchronizationManager *_Nonnull sync;
Swift
var sync: TKSynchronizationManager { get }
-
Shared Directions Manager instance to provide directions- & routing-related stuff.
Warning
Experimental.Declaration
Objective-C
@property (readonly, strong, nonatomic) TKDirectionsManager *_Nonnull _directions;
Swift
var _directions: TKDirectionsManager { get }
-
Shared Events Manager instance to retain event handlers.
Declaration
Objective-C
@property (readonly, strong, nonatomic) TKEventsManager *_Nonnull events;
Swift
var events: TKEventsManager { get }