The code has been written in Swift version 3 and uses Cocoapods for installing dependencies.
This repository contain the code for the Fyber Offer Challenge
, and contain 2 folders, OfferFramework
folder contain code for the SDK that generate a Universal framework that can be integrated in the projects, and FyberOffer-Example
contains a demo project using the SDK for fetching offers.
This folder contain code for rudimentary SDK for fetching Offers from the Fyber Server after providing AppId, UserId and API Key. To generate the Universal Framework the following Steps has to be followed.
* Open OfferFramework.xcodeproj.
* Select Generic Device from the Deivce List.
* Click on Product and than Archive
* After some seconds the Orangizer will open, please wait couple of seconds and it will open the Finder window with the Project folder that will contain Universal framework.
* Xcode 8, Swift 3 , iOS 10
To use this framework in your project you need to follow these steps
* Create new project in Xcode.
* Add `Podfile` and add `SwiftyJSON` and `CryptoSwift` in that `Podfile`
* Install the Pods and than open the project by using the pods workspace
* Drag the `OfferFramework.framework` (generated by following above steps) in your project
* Dont forget to add that framework in the embedded binaries as well.
* Open any ViewController class in which you want to show the Offers, add Import OfferFramework.
let options = FYBOfferOptions(appID: "provide app id", userID: "provide user id", securityToken: "provide api key")
let sdk = FyberOfferSDK(options: options)
sdk.delegate = self
sdk.loadOffers(parentController: self)
}
These are the optional delegates that updates the Controller about the different events for loading offers
func offersDidLoad()
func offerDidLoadOnView(offer: FyberOfferModel)
func offersDidClose()
func offersRecevied(totalOffers: Int)
func offersLoadFailedWithError(error: String)
func userSelectedOffer(offer: FyberOfferModel)
This Project also include unit tests that check whether network calls are working fine or not and also whether the request parameters are generating correct url or not also contain test that check whether the ViewController is being loaded or not and chech the functionality of that Offer View Controller.
This folder contain a demo project that uses the OfferFramework
to load the offers, please update the pods before using the demo project.