Steps to initialize SnapscreenFramework functionality.
For any class that requires access to the SnapscreenFramework functionality, add the following line:
In order to initialize Snapscreen, call the following class method in AppDelegate in application:didFinishLaunchingWithOptions:
To improve performance, SnapOdds requires basic locational information to be provided. Set the users country and US state information within the SDK using the parameters country and usState:
Once Snapscreen is initialized, it can be retrieved by calling:
Installing the iOS SDK.
The easiest (and recommended) way to use Snapscreen is to integrate via SwiftPM. To integrate via SwiftPM, add the location of the github repository and the version to your Package.swift file, as shown below:
Snapscreen is provided as an iOS xcframework and bundles everything necessary for it to operate.
Drag the Snapscreenframework.xcframework to your iOS project
Make sure Xcode has added the framework to your project's Framework, Libraries and Embedded Content section in your General Settings
Make sure to change the Embed setting to Embed & Sign.
The snapping functionality relies on permission to access the camera of your iOS device to function. Access to the camera requires developers to provide a description of the camera's usage in the application. To add this camera usage description, add the key NSCameraUsageDescription into your application's Info.plist, and describe how the camera is used for the snapping functionality.
SnapOdds Sports Media provides a complete flow including the Snapping UI for snapping Sport Events and then displaying all available odds for the recognized sport event.
Customizing displayed messages. colors and fonts.
To customize colors in SnapViewController
and OddsResultsViewController
, use the SnapscreenUIColorConfiguration
object on the Snapscreen instance.
To customize fonts in SnapViewController
and OddsResultsViewController
, use the SnapscreenUIFontConfiguration
object on the Snapscreen instance.
To customize displayed messages in the SnapViewController
use the SnapscreenSnapUIConfiguration
object on the Snapscreen instance.
All desired customizations must be done prior to presenting the SnapViewController
. While it is also possible to modify the configuration between presentations of the SnapViewController
, modifications initiated while the ViewController
is present are not guaranteed to be respected.
To customize displayed messages in the OddsResultsViewController
use the SnapscreenOddsUIConfiguration
object on the Snapscreen instance.
All desired customizations must be done prior to present the SnapViewController
and subsequently the OddsResultsViewController
. While it is also possible to modify the configuration between presentations of the OddsResultsViewController
, modifications initiated while the ViewController
is present are not guaranteed to be respected.
Verify the SDK is initialized.
Retrieve an instance of SnapViewController
with your desired (or the default) SnapConfiguration
Present the SnapViewController
(the recommended presentation is modally in a UINavigationController
)
The following code illustrates a SnapViewController
with the default configuration.
If you do not want or need to customize the snapping configuration, you can also omit the configuration
parameter.
Once a sporting event is successfully snapped, the OddsResultsViewController
is automatically pushed in the UINavigationController
and the odds for the snapped game are presented.
If the sporting event is not successfully snapped, an error message will appear in the viewfinder: "Your snap returned no results. Make sure your TV is visible in the viewfinder"
Applications must request user permission for camera access, and camera access is required for the app to function. For this reason, your application should be set to ask permission from the user to access the camera, and to receive said permission, before presenting the Snap UI. The following code will set your application to request and receive permission prior to opening Snap UI:
SnapOdds recommends presentingSnapViewController
in a UINavigationController
. Please note that SnapViewController itself does not present any cancellation item within the UI. The developer of the application is responsible for configuring a cancel item on the presented UINavigationController
.
Currently, Snap UI is optimized only for portrait orientation. We recommend that you limit the supported interface orientations for the presented UINavigationController to portrait only.