iOS SDK
Genuin iOS SDK comprises features such as brand feed, communities, and groups.
Requirements
Platform | Minimum Deployment Target | Language | Supported Orientations | Supported Destinations |
---|---|---|---|---|
iOS | 13.0 | Swift | Portrait | iPhone |
Required Permissions
Required Permissions to be added in info.plist
file of your application
Permission | Usage |
---|---|
Camera (NSCameraUsageDescription) | Genuin needs permissions to open your camera and microphone. This allows Genuin to record videos that can be shared with other people. |
Microphone (NSMicrophoneUsageDescription) | Genuin needs permissions to open your camera and microphone. This allows Genuin to record videos that can be shared with other people. |
Photos (NSPhotoLibraryUsageDescription) | Genuin needs permissions to access your photo library. This allows Genuin to download videos to your phone and save it to your library. |
Speech Recognition (NSSpeechRecognitionUsageDescription) | The transcript of your recording will be displayed to you in the end for you to overlay it on the audio message. |
Contacts (NSContactsUsageDescription) | Genuin requires to sync with your contacts and provide a better experience when you wish to share your posts with them. |
Location (NSLocationWhenInUseUsageDescription) | Your precise location will help us suggest your community details more accurately. |
Installation
Standard CocoaPods Install
If your project doesn’t have the CocoaPods setup then start with pod init
which will create the Podfile, else do following changes in the pod file to install GenuinSDK.
If you are using Xcode 16 then kindly refer the below podfile :
Example
Import the GenuinSDK module in your SceneDelegate/AppDelegate
.
To load your lottie animation accross the Genuin SDK, you can add it here configuration.setCustomLoader("YOUR_LOADER", bundle: .main)
Instructions for SceneDelegate
:
- Ensure you are using the
UISceneDelegate
in your app. - In your
SceneDelegate.swift
file, implement thescene(_:willConnectTo:options:)
method. - Use the shared configuration and set up any custom loaders or additional parameters.
- Call
GenuinSDK.shared.initialize(apiKey: "YOUR_API_KEY", configuration: configuration)
with your API key and the configured options. - Ensure that
GenuinSDK.shared.scene(scene, willConnectTo: session, options: connectionOptions)
is called to notify the SDK of the scene connection.
Instructions for AppDelegate
:
- In your
AppDelegate.swift
, implement theapplication(_:didFinishLaunchingWithOptions:)
method. - Set up the shared configuration and initialize the SDK with your API key.
- Call
GenuinSDK.shared.initialize(apiKey: "YOUR_API_KEY", configuration: configuration)
with your API key and the configured options. - Return
true
to indicate successful launch configuration.
Then you can display the home feed view controller. For example, to use it in your UITabBarController
:
To present feed from your UIViewController by clicking on UIButton:
iOS version 15.0
and above, but if you are using iOS version 13
or 14
then put this if #available(iOS 15.0, *)
condition while importing the GenuinSDK. Refer to the below code block Embed
Carousel Embed
YOUR_EMBED_ID
, YOUR_CONTAINER_VIEW
in which you want the embed, and YOUR_VIEW_CONTROLLER
containing your container view, while calling the below function. For auto login in the SDK, you shall pass “YOUR_SSO_TOKEN” in order to implement Embed with SSO in your app. To configure the EmbedConfiguration
based on your need you can change the below values.
-
isShowProfileEnabled = This is an optional boolean parameter. Default value is false. If this parameter is true and also if user is logged in than Profile picture will be visible in full screen view (right side top corner). On clicking the profile picture user will see the account settings and logout options.
-
isDirectDeepLinkEnabled = This is an optional boolean parameter. Default value is false. If this parameter is true then all the interaction/clicks in the full screen view will redirect to the specific video in white labelled app associated with video and also value of this parameter “interactionDeepLink” will be ignored. If not passed then the regular flow will work.
-
interactionDeepLink = This is an optional parameter. You can pass a deeplink URL in this parameter. If a deeplink URL is given then all the interaction/clicks in the full screen view will redirect to the deeplink URL given. If not passed then the regular flow will work. It should be a correct URL else user will not be redirected.
Full Screen Embed
Note: To fetch the Embed you need to add YOUR_EMBED_ID
, YOUR_CONTAINER_VIEW
in which you want the embed, and YOUR_VIEW_CONTROLLER
containing your container view, while calling the above function. For auto login in the SDK, you shall pass “YOUR_SSO_TOKEN” in order to implement Embed with SSO in your app.
To configure the EmbedConfiguration
based on your need you can change the below values.
-
isShowProfileEnabled = This is an optional boolean parameter. Default value is false. If this parameter is true and also if user is logged in than Profile picture will be visible in full screen view (right side top corner). On clicking the profile picture user will see the account settings and logout options.
-
isDirectDeepLinkEnabled = This is an optional boolean parameter. Default value is false. If this parameter is true then all the interaction/clicks in the full screen view will redirect to the specific video in white labelled app associated with video and also value of this parameter “interactionDeepLink” will be ignored. If not passed then the regular flow will work.
-
interactionDeepLink = This is an optional parameter. You can pass a deeplink URL in this parameter. If a deeplink URL is given then all the interaction/clicks in the full screen view will redirect to the deeplink URL given. If not passed then the regular flow will work. It should be a correct URL else user will not be redirected.
Standard Wall Embed
Note: To fetch the Embed you need to add YOUR_EMBED_ID
while calling the above function.
To configure the EmbedConfiguration
based on your need you can change the below values.
- isShowProfileEnabled = This is an optional boolean parameter. Default value is false. If this parameter is true and also if user is logged in than Profile picture will be visible in full screen view (right side top corner). On clicking the profile picture user will see the account settings and logout options.
Handle SSO Login Explicitly in SDK
To Auto Login in the SDK, You need to call below method, whenever user is log in to your application.
Handle SSO Login in Embed
Optional Parameters
Below are the optional parameters:
- name - This is an optional string parameter. Pass this parameter for ‘
signup/login
’. - mobile - This is an option string parameter. Pass this parameter for
signup/login
. - email - This is an optional string parameter. Pass this parameter for
signup/login
. - nickname - This is an optional string parameter. If nickname is available in genuin ecosystem it will be used, else genuin will generate of its own.
- profile_image: This is an optional string parameter. Pass the
profile_image
parameter if you want to show the profile image in the SDK.
Note: mobile
parameter will be first priority if it is passed along with email for login/signup
.
Custom Login
If you want to handle login process as per your requirement then follow the below steps:
Step 1: Assign Delegate while initializing Genuin SDK
Step 2: Extend GenuinDelegate & Present your own controller on provided base controller
Step 3: Must call below login service from Genuin, to keep user logged in, in Genuin SDK.
Handle SSO Logout in SDK
Whenever user logs out from your application call the below method.
Handling Deep Link
Prerequisite:
-
Make sure you have white labelled your community by following these steps
-
Enable Associated Domains in Certificates, Identifiers & Profiles using your Apple Developer account at https://developer.apple.com/account/resources/identifiers/list
-
Create apple-app-site-association (without extension) file with following settings:
Once the file is created, host it on the white labeled domain at https://YOUR_WHITE-LABELLED_DOMAIN/.well-known/apple-app-site-association
- Add Associated Domains in capabilities if not already,
Add applinks in domains, for Example:
applinks: YOUR_WHITE-LABELLED_DOMAIN
applinks: www.YOUR_WHITE-LABELLED_DOMAIN
To handle deep links in your app use the following methods.
Note: GenuinSDK.shared.willHandleDeepLink(url: dlURL)
function will check whether GenuinSDK
will handle the given deeplink or not. You can use it according to your deeplink redirection flow.
Instructions for SceneDelegate
:
- In
SceneDelegate.swift
, implement thescene(_:continue:)
method. - Notify the SDK of the continued scene via
GenuinSDK.initDeeplinkWith(url: dlURL)
. - Handle deep links using the root view controller by calling
GenuinSDK.shared.handleDeeplink(viewController: rootVC)
.
NOTE: To handle redirection of the deeplink , it is mandatory to call GenuinSDK.initDeeplinkWith(url: dlURL)
Instructions for AppDelegate
:
- In
AppDelegate.swift
, implement theapplication(_:continue:restorationHandler:)
method. - Notify the SDK of the continued scene via
GenuinSDK.initDeeplinkWith(url: dlURL)
. - Use
GenuinSDK.shared.handleDeeplink(viewController: rootVC)
to manage the deep link using the app’s root view controller.
Note:
-
To handle the Deeplink from another controller call the
GenuinSDK.shared.handleDeeplink(viewController: vc)
function from specific controller -
If you are following the
SceneDelegate
method then calling thisGenuinSDK.shared.handleDeeplink(viewController: self)
function is mandatory
Handling Push Notifications
Using Firebase
-
Create an app in your firebase console by following these steps
-
Download the
GoogleService-Info.plist
file and add it in xcode project -
Add pod in pod file
-
To enable the push notifications functionality then enable the Push Notifications in your target. To do so,
Select the target > Signing & Capabilities > Add Capability of Push Notification
-
Import
AppDelegate
true
value in isFCMIntegrated
parameter, as we are using the Firebase. - Initialize
SceneDelegate
- Place this code to take the user permission for Push Notification
- Extend
MessagingDelegate
and Add follwing method:
- To Handle the Push Notification Redirection whenever the user taps, follow the below code
GenuinSDK.shared.willHandleNotification(userInfo: userInfo)
function will check whether GenuinSDK
will handle the given notification or not. You can use it according to your notification redirection flow. - To configure notification UI
- If you want to handle the notification when app is opened then follow the below code
Note: To handle the notification from another controller call the GenuinSDK.shared.handleNotifications(viewController: YOUR_VIEW_CONTROLLER)
function
Using APNS
-
To enable the push notifications functionality then enable the Push Notifications in your target. To do so,
Select the target > Signing & Capabilities > Add Capability of Push Notification
-
Import
AppDelegate
false
value in isFCMIntegrated
parameter, as we are not using the Firebase. SceneDelegate
Initialize
- Place this code to take the user permission for Push Notification
- To Handle the Push Notification Redirection whenever the user taps, follow the below code
GenuinSDK.shared.willHandleNotification(userInfo: userInfo)
function will check whether GenuinSDK
will handle the given notification or not. You can use it according to your notification redirection flow. - To configure notification UI
- If you want to handle the notification when app is opened then follow the below code
GenuinSDK.shared.handleNotifications(viewController: YOUR_VIEW_CONTROLLER)
function. What’s next?
Android SDK
Integrate Android SDK in Your ecosystem.
Web SDK
Integrate Web SDK in your ecosystem.
React Native SDK
Integrate React Native SDK in your ecosystem.
Support
If you need any assistance or have any questions, feel free to email us at support@begenuin.com.
Was this page helpful?