To integrate Avataar's renderer with your ios application, you will need the following equipment as a basic requirement:
Xcode - Apple's integrated development environment (IDE)
Ios version : 16 & above
Camera permission needs to be enabled
Please follow the below steps to install the package in your ios application :
Add the following permission entry to your app's `Info.plist` file:
Key: `Privacy - Camera Usage Description`
Value: `$(PRODUCT_NAME) camera use`
Next , you need to go to “File” and click on “Add Package…”
Once the package is added, please search for the following URL and add the package by clicking on the ‘Add Package’ button at the bottom right corner.
https://github.com/SoulVisionCreations/avataar-gemini-castor-package
The package will be added to your application.
As a next step, please import the `GeminiCastorFramework` module into your Swift file by adding the below code snippet.
import GeminiCastorFramework
You now have to access GeminiView which is exported from the GeminiCastorFramework. Create an instance of the Gemini Renderer by calling `GeminiView()`. The `GeminiView` initializer takes two parameters:
Your token (generated on Avataar Apollo/shared by Avataar)
Config URL (generated when publishing an asset in Avataar Apollo Configurator)
Please follow the below steps to integrate Avataar's renderer with your iOS application:
1. Create a “NavigationView” and wrap the ‘’NavigationLink’’ package inside it.
2. Set the navigation style to stack:
.navigationViewStyle(.stack) <Important>
3. Add the below parameters to the ‘’NavigationLink’’ in order to navigate to the GeminiView,
NavigationLink(
"",
destination: GeminiView(token: yourToken, configURL : yourConfigURL),
isActive: $isActive
)
4. To enable or disable the view, toggle the `isActive` variable. By default, please set the “isActive” variable to false to avoid triggering the view on onload of the application.
Here’s a sample of implementing the Renderer integration post installing the package.
import SwiftUI
import GeminiCastorFramework
struct ContentView: View {
let dummyToken = "your_token"
let configName = "your_config_name"
@State private var isActive = false
var body: some View {
NavigationView {
NavigationLink("",destination: GeminiView(token: dummyToken, configURL: configName),
isActive: $isActive
)
}
.navigationViewStyle(.stack)
}
}