iOS
This page will guide you through the integration of Revlum in your iOS app
1. Add the Revlum SDK to Your Project
To import the Revlum SDK into your iOS project, simply add the GitHub repository as a package dependency.
In Xcode, go to File > Add Packages.
Paste the following URL when prompted: https://github.com/revlum/ios
Add the Revlum SDK to your project.
2. Configure the SDK
Configure the SDK by providing your API key, along with optional parameters like userId and subId. If you do not provide a user ID, the SDK will automatically generate one. If a user ID is set, it will be used unless manually changed..
import RevlumOfferwallSDK
RevlumOfferwallSdk.shared.configure(
apiKey: "myapikey1234567890",
subId: nil,
userId: "myuserid"
)
3. Show the Offerwall
SwiftUI Example
Use NavigationLink
to present the OfferwallView:.
import RevlumOfferwallSDK
NavigationLink(destination: RevlumOfferwallSdk.shared.offerwallView) {
Text("Open Offerwall")
}
UIKit Example
To display the OfferwallView using UIKit, push the UIHostingController
with the OfferwallView:
import RevlumOfferwallSDK
self.navigationController?.pushViewController(
UIHostingController(rootView: RevlumOfferwallSdk.shared.offerwallView),
animated: true
)
For UIKit, ensure that you configure a UINavigationController
in the SceneDelegate:
import RevlumOfferwallSDK
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UINavigationController(rootViewController: ViewController())
window.makeKeyAndVisible()
self.window = window
}
}
4. Check for a Reward
To check for a reward, use the checkReward
function. It requires a reward callback, which returns a reward value (0 if there is no reward) and a list of conversions, as well as an error callback..
import RevlumOfferwallSDK
RevlumOfferwallSdk.shared.checkReward(
onCheckReward: { checkReward in
print("Check Reward Success: \(checkReward)")
},
onError: { error in
print("Check Reward Error: \(error)")
}
)
Updated 2 months ago