GEMSdk
Objective-C
@interface GEMSdk : NSObject
Swift
class GEMSdk : NSObject
This class is the entry point in Gem iOS Sdk.
-
The delegate for the GEM Sdk.
Declaration
Objective-C
@property (nonatomic, weak) NSObject<GEMSdkDelegate> *_Nullable delegate;
Swift
weak var delegate: (any GEMSdkDelegate)? { get set }
-
Not available. Please use initSdk.
Declaration
Objective-C
- (nonnull instancetype)init;
-
Returns the singleton SDK instance.
Declaration
Objective-C
+ (nonnull GEMSdk *)shared;
Swift
class func shared() -> GEMSdk
-
Makes all the proper initialisation of the SDK.
Declaration
Objective-C
- (BOOL)initSdk:(nonnull NSString *)authorizationKey;
Swift
func initSdk(_ authorizationKey: String) -> Bool
Parameters
authorizationKey
The Project API Key. @discussion The Project API Key can be found at: https://developer.magiclane.com/api/projects @discussion By default the SDK language is the device preferred language and region.
Return Value
Successfully initialisation state.
-
Makes all the proper initialisation of the SDK.
Declaration
Objective-C
- (SDKErrorCode)initSdk:(nonnull NSString *)authorizationKey language:(nonnull NSString *)language completionHandler:(nonnull void (^)(SDKErrorCode))handler;
Swift
func initSdk(_ authorizationKey: String, language: String, completionHandler handler: @escaping (SDKErrorCode) -> Void) -> SDKErrorCode
Parameters
authorizationKey
The Project API Key.
language
The SDK language. The language form might be : “ISO 639-3 language code - ISO 3166-1_3 region code ( optional )”, e.g. “eng” for generic English, “eng-USA” for English American. The language form might be also: “ISO 639-1 language code - ISO 3166-1_2 region code ( optional )”, e.g. “en” for generic English, “en-US” for English American.
handler
Completion block with the init phase result code. @discussion The Project API Key can be found at: https://developer.magiclane.com/api/projects
Return Value
Initialisation code. SDKErrorCodeKNoError for initialisation succeeded.
-
Makes only the core initialisation of the SDK.
Declaration
Objective-C
- (BOOL)initCoreSdk:(nonnull NSString *)authorizationKey;
Swift
func initCoreSdk(_ authorizationKey: String) -> Bool
Parameters
authorizationKey
The Project API Key. @discussion The Project API Key can be found at: https://developer.magiclane.com/api/projects @discussion By default the SDK language is the device preferred language and region. @details Dedicated for Flutter native.
Return Value
Successfully initialisation state.
-
Makes only the core initialisation of the SDK.
Declaration
Objective-C
- (SDKErrorCode)initCoreSdk:(nonnull NSString *)authorizationKey language:(nonnull NSString *)language completionHandler:(nonnull void (^)(SDKErrorCode))handler;
Swift
func initCoreSdk(_ authorizationKey: String, language: String, completionHandler handler: @escaping (SDKErrorCode) -> Void) -> SDKErrorCode
Parameters
authorizationKey
The Project API Key.
language
The SDK language. The language form might be : “ISO 639-3 language code - ISO 3166-1_3 region code ( optional )”, e.g. “eng” for generic English, “eng-USA” for English American. The language form might be also: “ISO 639-1 language code - ISO 3166-1_2 region code ( optional )”, e.g. “en” for generic English, “en-US” for English American.
handler
Completion block with the init phase result code. @discussion The Project API Key can be found at: https://developer.magiclane.com/api/projects @details Dedicated for Flutter native.
Return Value
Initialisation code. SDKErrorCodeKNoError for initialisation succeeded.
-
Verifies if authorization key is valid. Online connection must be available.
Declaration
Objective-C
- (void)verifySdk:(nonnull NSString *)authorizationKey completionHandler:(nonnull void (^)(AuthorizationKeyStatus))handler;
Swift
func verifySdk(_ authorizationKey: String) async -> AuthorizationKeyStatus
Parameters
authorizationKey
The Project API Key.
handler
The block to execute asynchronously with the result.
-
Returns the SDK capabilities.
Declaration
Objective-C
- (nonnull NSArray<NSNumber *> *)getCapabilities;
Swift
func getCapabilities() -> [NSNumber]
Return Value
A package of [ESdkCapabilities] flags
-
Makes all the proper de-initialisation of the SDK.
Declaration
Objective-C
- (void)cleanDestroy;
Swift
func cleanDestroy()
-
Returns the Sdk version.
Declaration
Objective-C
- (nonnull NSString *)getVersion;
Swift
func getVersion() -> String
-
Tells the SDK to use NSTimer timer.
Declaration
Objective-C
- (void)useSystemTimer;
Swift
func useSystemTimer()
-
Tells the SDK to use CADisplayLink timer.
Declaration
Objective-C
- (void)useDisplayLink;
Swift
func useDisplayLink()
-
Tells the SDK that the app is running in the background and is no longer onscreen.
Declaration
Objective-C
- (void)appDidEnterBackground;
Swift
func appDidEnterBackground()
-
Tells the SDK that the app became active and is now responding to user events.
Declaration
Objective-C
- (void)appDidBecomeActive;
Swift
func appDidBecomeActive()
-
Set the unit system to be used by the SDK.
Declaration
Objective-C
- (void)setUnitSystem:(UnitSystemType)type;
Swift
func setUnitSystem(_ type: UnitSystemType)
Parameters
type
The unit system type.
-
Set the 24 hours format notation.
Declaration
Objective-C
- (void)set24HourFormatNotation:(BOOL)state;
Swift
func set24HourFormatNotation(_ state: Bool)
Parameters
state
The state value.
-
Set maximum space to download tiles in kilobytes (Kb).
Declaration
Objective-C
- (void)setTilesMaxSpace:(int)maxSpace;
Swift
func setTilesMaxSpace(_ maxSpace: Int32)
Parameters
maxSpace
Size in Kb. @details If maxSpace is 0 there are no restriction for tiles space.
-
Get maximum space to download tiles in kilobytes (Kb).
Declaration
Objective-C
- (int)getTilesMaxSpace;
Swift
func getTilesMaxSpace() -> Int32
Return Value
Size in Kb.
-
Returns the unit system used by the SDK.
Declaration
Objective-C
- (UnitSystemType)getUnitSystem;
Swift
func getUnitSystem() -> UnitSystemType
-
Set the map language selection method.
Declaration
Objective-C
- (void)setMapLanguage:(MapLanguageType)type;
Swift
func setMapLanguage(_ type: MapLanguageType)
-
Get the current setting for the map language selection.
Declaration
Objective-C
- (MapLanguageType)getMapLanguage;
Swift
func getMapLanguage() -> MapLanguageType
-
Set a custom decimal separator.
Declaration
Objective-C
- (void)setDecimalSeparator:(nonnull NSString *)value;
Swift
func setDecimalSeparator(_ value: String)
-
Get the current decimal separator.
Declaration
Objective-C
- (nonnull NSString *)getDecimalSeparator;
Swift
func getDecimalSeparator() -> String
-
Set a custom digit group separator.
Declaration
Objective-C
- (void)setDigitGroupSeparator:(nonnull NSString *)value;
Swift
func setDigitGroupSeparator(_ value: String)
-
Get the current digit group separator.
Declaration
Objective-C
- (nonnull NSString *)getDigitGroupSeparator;
Swift
func getDigitGroupSeparator() -> String
-
Set the SDK language. @details The language form might be :“ISO 639-1 language code - ISO 3166-1_2 region code ( optional )”, e.g. “en” for generic English, “en-US” for English American. @details The language form might be: “ISO 639-3 language code - ISO 3166-1_3 region code ( optional )”, e.g. “eng” for generic English, “eng-USA” for English American.
Declaration
Objective-C
- (void)setLanguage:(nonnull NSString *)language;
Swift
func setLanguage(_ language: String)
Parameters
language
The unit system type.
-
Allow / deny internet connection.
Declaration
Objective-C
- (void)setAllowConnection:(BOOL)state;
Swift
func setAllowConnection(_ state: Bool)
-
Returns true if the connection is allowed or not.
Declaration
Objective-C
- (BOOL)getAllowConnection;
Swift
func getAllowConnection() -> Bool
-
Returns true if there is online connection .
Declaration
Objective-C
- (BOOL)isOnlineConnection;
Swift
func isOnlineConnection() -> Bool
-
Returns true if there is Wifi connection .
Declaration
Objective-C
- (BOOL)isWiFiConnected;
Swift
func isWiFiConnected() -> Bool
-
Returns true if there is mobile data connection .
Declaration
Objective-C
- (BOOL)isMobileDataConnected;
Swift
func isMobileDataConnected() -> Bool
-
Compress the data buffer.
Declaration
Objective-C
- (nullable NSData *)compress:(nonnull NSData *)data;
Swift
func compress(_ data: Data) -> Data?
-
Uncompress the data buffer.
Declaration
Objective-C
- (nullable NSData *)uncompress:(nonnull NSData *)data;
Swift
func uncompress(_ data: Data) -> Data?
-
Allow the given service type on the extra charged network type. By default all are allowed.
Declaration
Objective-C
- (void)setOffboardService:(ServiceGroupType)type allowExtraChargedNetwork:(BOOL)allow;
Swift
func setOffboardService(_ type: ServiceGroupType, allowExtraChargedNetwork allow: Bool)
-
Check if the given service type is allowed on the extra charged network.
Declaration
Objective-C
- (BOOL)getAllowExtraChargedNetworkForOffboardService:(ServiceGroupType)type;
Swift
func getAllowExtraChargedNetwork(forOffboardService type: ServiceGroupType) -> Bool
-
Get transfer statistics for given service type.
Declaration
Objective-C
- (nullable TransferStatisticsContext *)getTransferStatistics: (ServiceGroupType)type;
Swift
func getTransferStatistics(_ type: ServiceGroupType) -> TransferStatisticsContext?
-
Activate the debug logger.
Declaration
Objective-C
- (void)activateDebugLogger;
Swift
func activateDebugLogger()
-
Deactivate the debug logger.
Declaration
Objective-C
- (void)deactivateDebugLogger;
Swift
func deactivateDebugLogger()
-
Print a log message using Sdk logging.
Declaration
Objective-C
- (void)logMessage:(nonnull NSString *)string;
Swift
func logMessage(_ string: String)
-
Check if log is silent.
Declaration
Objective-C
- (BOOL)isLogSilent;
Swift
func isLogSilent() -> Bool
-
Get Stripe public key for stripe initialization.
Declaration
Objective-C
- (SDKErrorCode)getStripePublicKeyInTestMode:(BOOL)testMode completionHandler: (nonnull void (^)(NSString *_Nonnull, SDKErrorCode))handler;
Swift
func getStripePublicKey(inTestMode testMode: Bool, completionHandler handler: @escaping (String, SDKErrorCode) -> Void) -> SDKErrorCode
Parameters
testMode
Enables a dry run call for testing.
-
Get Stripe secret for a pay session creation.
Declaration
Objective-C
- (SDKErrorCode)getStripeSessionInTestMode:(BOOL)testMode amount:(double)amount currency:(nonnull NSString *)currency completionHandler: (nonnull void (^)(NSString *_Nonnull, SDKErrorCode))handler;
Swift
func getStripeSession(inTestMode testMode: Bool, amount: Double, currency: String, completionHandler handler: @escaping (String, SDKErrorCode) -> Void) -> SDKErrorCode
Parameters
testMode
Enables a dry run call for testing.
amount
Amount of currency sent. If a too small value is provided, the server will return error KInvalidValue.
currency
The currency of the amount value, e.g. “eur” for Euro.