SnapscreenKit
@interface SnapscreenKit : NSObject
SnapscreenKit offers integration of the Snapscreen functions in your app. Before using, make sure to initially SnapscreenKit with the appropriate clientID and clientSecret and provide optional additional handlers.
-
+sharedSnapscreenKitWithClientID:clientSecret:testEnvironment:loggingHandler:locationProvider:delegate:
Initialize SnapscreenKit
Declaration
Objective-C
+ (instancetype _Nonnull) sharedSnapscreenKitWithClientID:(NSString *_Nonnull)clientID clientSecret:(NSString *_Nonnull)clientSecret testEnvironment:(BOOL)connectToTestEnvironment loggingHandler: (id<SnapscreenLoggingHandler> _Nullable)loggingHandler locationProvider:(id<SnapscreenLocationProvider> _Nullable) locationProvider delegate: (id<SnapscreenKitDelegate> _Nullable)delegate;
Swift
class func sharedSnapscreenKit(withClientID clientID: String, clientSecret: String, testEnvironment connectToTestEnvironment: Bool, loggingHandler: SnapscreenLoggingHandler?, locationProvider: SnapscreenLocationProvider?, delegate: SnapscreenKitDelegate?) -> Self
Parameters
clientID
The client ID of your application - provided by Snapscreen
clientSecret
The client secret of your application - provided by Snapscreen
connectToTestEnvironment
Whether you want SnapscreenKit connect to the test environment of Snapscreen. Pass NO for production use in Release Builds.
loggingHandler
An optional logging handler. Pass if you want to receive log messages from SnapscreenKit in your application and attach them to your custom logging solution. For logging to NSLog there is a default implementation in
SnapscreenNSLogLoggingHandler
locationProvider
An optional location provider. If your application determines the user’s location in some way, provide this and SnapscreenKit will also use the user’s location to improve result quality.
delegate
The SnapscreenKit delegate
-
+sharedSnapscreenKitWithClientID:clientSecret:testEnvironment:backendURL:clipsharingBackendURL:loggingHandler:locationProvider:delegate:trackingDelegate:
Initialize SnapscreenKit with custom backend URLs
Declaration
Objective-C
+ (instancetype _Nonnull) sharedSnapscreenKitWithClientID:(NSString *_Nonnull)clientID clientSecret:(NSString *_Nonnull)clientSecret testEnvironment:(BOOL)connectToTestEnvironment backendURL:(NSString *_Nullable)backendURL clipsharingBackendURL:(NSString *_Nullable)clipsharingBackendURL loggingHandler: (id<SnapscreenLoggingHandler> _Nullable)loggingHandler locationProvider:(id<SnapscreenLocationProvider> _Nullable) locationProvider delegate: (id<SnapscreenKitDelegate> _Nullable)delegate trackingDelegate: (id<SnapscreenKitTrackingDelegate> _Nullable) trackingDelegate;
Swift
class func sharedSnapscreenKit(withClientID clientID: String, clientSecret: String, testEnvironment connectToTestEnvironment: Bool, backendURL: String?, clipsharingBackendURL: String?, loggingHandler: SnapscreenLoggingHandler?, locationProvider: SnapscreenLocationProvider?, delegate: SnapscreenKitDelegate?, trackingDelegate: SnapscreenKitTrackingDelegate?) -> Self
Parameters
clientID
The client ID of your application - provided by Snapscreen
clientSecret
The client secret of your application - provided by Snapscreen
connectToTestEnvironment
Whether you want SnapscreenKit connect to the test environment of Snapscreen. Pass NO for production use in Release Builds.
backendURL
The URL string for the standard Snapscreen backend - if nil uses the default URL based on the environment
clipsharingBackendURL
The URL string for the Snapscreen clip sharing backend - if nil uses the default URL based on the environment
loggingHandler
An optional logging handler. Pass if you want to receive log messages from SnapscreenKit in your application and attach them to your custom logging solution. For logging to NSLog there is a default implementation in
SnapscreenNSLogLoggingHandler
locationProvider
An optional location provider. If your application determines the user’s location in some way, provide this and SnapscreenKit will also use the user’s location to improve result quality.
delegate
The SnapscreenKit delegate
trackingDelegate
An optional tracking delegate to receive events from the SDK
-
+sharedSnapscreenKitWithClientID:clientSecret:testEnvironment:backendURL:clipsharingBackendURL:loggingHandler:locationProvider:delegate:
Initialize SnapscreenKit with custom backend URLs
Declaration
Objective-C
+ (instancetype _Nonnull) sharedSnapscreenKitWithClientID:(NSString *_Nonnull)clientID clientSecret:(NSString *_Nonnull)clientSecret testEnvironment:(BOOL)connectToTestEnvironment backendURL:(NSString *_Nullable)backendURL clipsharingBackendURL:(NSString *_Nullable)clipsharingBackendURL loggingHandler: (id<SnapscreenLoggingHandler> _Nullable)loggingHandler locationProvider:(id<SnapscreenLocationProvider> _Nullable) locationProvider delegate: (id<SnapscreenKitDelegate> _Nullable)delegate;
Swift
class func sharedSnapscreenKit(withClientID clientID: String, clientSecret: String, testEnvironment connectToTestEnvironment: Bool, backendURL: String?, clipsharingBackendURL: String?, loggingHandler: SnapscreenLoggingHandler?, locationProvider: SnapscreenLocationProvider?, delegate: SnapscreenKitDelegate?) -> Self
Parameters
clientID
The client ID of your application - provided by Snapscreen
clientSecret
The client secret of your application - provided by Snapscreen
connectToTestEnvironment
Whether you want SnapscreenKit connect to the test environment of Snapscreen. Pass NO for production use in Release Builds.
backendURL
The URL string for the standard Snapscreen backend - if nil uses the default URL based on the environment
clipsharingBackendURL
The URL string for the Snapscreen clip sharing backend - if nil uses the default URL based on the environment
loggingHandler
An optional logging handler. Pass if you want to receive log messages from SnapscreenKit in your application and attach them to your custom logging solution. For logging to NSLog there is a default implementation in
SnapscreenNSLogLoggingHandler
locationProvider
An optional location provider. If your application determines the user’s location in some way, provide this and SnapscreenKit will also use the user’s location to improve result quality.
delegate
The SnapscreenKit delegate
-
+sharedSnapscreenKitWithClientID:clientSecret:testEnvironment:loggingHandler:locationProvider:delegate:customTokenHandling:
Initialize SnapscreenKit and optionally tell the SDK to skip the automatic token handling. Note: This should never be necessary by SDK users!
Declaration
Objective-C
+ (instancetype _Nonnull) sharedSnapscreenKitWithClientID:(NSString *_Nonnull)clientID clientSecret:(NSString *_Nonnull)clientSecret testEnvironment:(BOOL)connectToTestEnvironment loggingHandler: (id<SnapscreenLoggingHandler> _Nullable)loggingHandler locationProvider:(id<SnapscreenLocationProvider> _Nullable) locationProvider delegate: (id<SnapscreenKitDelegate> _Nullable)delegate customTokenHandling:(BOOL)customTokenHandling;
Swift
class func sharedSnapscreenKit(withClientID clientID: String, clientSecret: String, testEnvironment connectToTestEnvironment: Bool, loggingHandler: SnapscreenLoggingHandler?, locationProvider: SnapscreenLocationProvider?, delegate: SnapscreenKitDelegate?, customTokenHandling: Bool) -> Self
Parameters
clientID
The client ID of your application - provided by Snapscreen
clientSecret
The client secret of your application - provided by Snapscreen
connectToTestEnvironment
Whether you want SnapscreenKit connect to the test environment of Snapscreen. Pass NO for production use in Release Builds.
loggingHandler
An optional logging handler. Pass if you want to receive log messages from SnapscreenKit in your application and attach them to your custom logging solution. For logging to NSLog there is a default implementation in
SnapscreenNSLogLoggingHandler
locationProvider
An optional location provider. If your application determines the user’s location in some way, provide this and SnapscreenKit will also use the user’s location to improve result quality.
delegate
The SnapscreenKit delegate
customTokenHandling
whether Snapscreenkit should perform automatic token handling. If no, the application itself is fully responsible for getting an access token, refreshing it and always keeping it up to date in the accessTokenHolder
-
Easily access SnapscreenKit once it was initialized before in your application.
Declaration
Objective-C
+ (instancetype _Nullable)sharedSnapscreenKit;
Swift
class func shared() -> Self?
-
Optional delegate if you want to receive callbacks from SnapscreenKit.
Declaration
Objective-C
@property (nonatomic, weak, readwrite, nullable) id<SnapscreenKitDelegate> delegate;
Swift
weak var delegate: SnapscreenKitDelegate? { get set }
-
The country code the user is in. Affects the results that are found when snapping. Defaults to AT.
Declaration
Objective-C
@property (nonatomic, strong, readwrite, nonnull) NSString *countryCode;
Swift
var countryCode: String { get set }
-
The locale identifier for the user. Affects the web search results that are found and how they are returned. Defaults to de_AT.
Declaration
Objective-C
@property (nonatomic, strong, readwrite, nonnull) NSString *localeIdentifier;
Swift
var localeIdentifier: String { get set }
-
A synchronized timestamp representing ‘now’ - use this if you need a current timestamp for other SnapscreenKit calls and don’t want or can’t use a result entry from a search.
Declaration
Objective-C
@property (nonatomic, readonly) long long currentSnapscreenTimestamp;
Swift
var currentSnapscreenTimestamp: Int64 { get }
-
Holds the logging handler that was provided when initializing SnapscreenKit.
Declaration
Objective-C
@property (nonatomic, strong, readwrite, nullable) id<SnapscreenLoggingHandler> loggingHandler;
Swift
var loggingHandler: SnapscreenLoggingHandler? { get set }
-
Holds the location provider that was provided when initializing SnapscreenKit.
Declaration
Objective-C
@property (nonatomic, strong, readwrite, nullable) id<SnapscreenLocationProvider> locationProvider;
Swift
var locationProvider: SnapscreenLocationProvider? { get set }
-
Holds an optional delegate that can receive various trackable events from the SDK
Declaration
Objective-C
@property (nonatomic, weak, readwrite, nullable) id<SnapscreenKitTrackingDelegate> trackingDelegate;
Swift
weak var trackingDelegate: SnapscreenKitTrackingDelegate? { get set }
-
Container which holds the current access token of SnapscreenKit.
Declaration
Objective-C
@property (atomic, strong, readonly, nonnull) SnapscreenAccessTokenHolder *accessTokenHolder;
Swift
var accessTokenHolder: SnapscreenAccessTokenHolder { get }
-
Whether SnapscreenKit performs automatic token handling (corresponds to the value passed in the initializer)
Declaration
Objective-C
@property (nonatomic, readonly) BOOL performsAutomaticTokenHandling;
Swift
var performsAutomaticTokenHandling: Bool { get }
-
The current customer configuration - mainly for internal use
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) SnapscreenCustomerConfiguration *customerConfiguration;
Swift
var customerConfiguration: SnapscreenCustomerConfiguration? { get }
-
Snapper to access a direct snapping and quadrangle detection API.
Declaration
Objective-C
@property (nonatomic, strong, readonly, nonnull) SnapscreenSnapper *snapper;
Swift
var snapper: SnapscreenSnapper { get }
-
Initializes a UIViewController for performing Snaps of Live TV. Should be presented as a modal UIViewController in your application for best experience.
Declaration
Objective-C
- (SnapscreenSnapViewController *_Nullable) instantiateSnapscreenSnapViewControllerWithDelegate: (id<SnapscreenSnapViewControllerDelegate> _Nonnull)delegate resultsDelegate: (id<SnapscreenSnapResultsViewControllerDelegate> _Nullable) resultsDelegate configuration: (SnapscreenSnapConfiguration *_Nonnull)snapConfiguration;
Swift
func instantiateSnapscreenSnapViewController(with delegate: SnapscreenSnapViewControllerDelegate, resultsDelegate: SnapscreenSnapResultsViewControllerDelegate?, configuration snapConfiguration: SnapscreenSnapConfiguration) -> SnapscreenSnapViewController?
Parameters
delegate
The delegate for the view controller that receives callbacks during the snapping process.
resultsDelegate
The delegate for the results view controller that provides customization capabilities for the results display.
snapConfiguration
The configuration for the snap
Return Value
SnapscreenSnapViewController A fully configured view controller for performing a snap. Returns null if you did not initialize SnapscreenKit correctly or an authentication error occured during initialization.
-
Initializes a UIViewController for performing Live AR display of Snap results. Should be presented as a modal UIViewController in your application for best experience.
Declaration
Objective-C
- (SnapscreenARSnapViewController *_Nullable) instantiateARSnapscreenSnapViewControllerWithDelegate: (id<SnapscreenARSnapViewControllerDelegate> _Nonnull)delegate configuration: (SnapscreenSnapConfiguration *_Nonnull) snapConfiguration;
Swift
func instantiateARSnapscreenSnapViewController(with delegate: SnapscreenARSnapViewControllerDelegate, configuration snapConfiguration: SnapscreenSnapConfiguration) -> SnapscreenARSnapViewController?
Parameters
delegate
The delegate for the view controller that receives callbacks during the snapping process.
snapConfiguration
The configuration for the snap
Return Value
SnapscreenARSnapViewController A fully configured view controller for performing a snap and displaying live AR results. Returns null if you did not initialize SnapscreenKit correctly or an authentication error occured during initialization.