In case you are developing your project in Swift, first of all congrats 🙂 and second of all, you’ll have to run by the following steps in order to make it work:

1) Drag the Outbrain SDK framework into your project

2) Create a bridging header yourself by choosing:
File > New > File > (iOS, watchOS, tvOS, or OS X) > Source > Header File

Name the file Outbrain-Bridging-Header.h

3) The header file content should be:

    #ifndef Outbrain_Bridging_Header_h
    #define Outbrain_Bridging_Header_h

    #import <OutbrainSDK/OutbrainSDK.h>

    #endif /* Outbrain_Bridging_Header_h */

4) In Xcode, go to:
Target (your target) >> Build Settings >> Swift Compiler >> Objective-C Briedging Header

5) Add the path of the header file you just created to the setting, see example:

8LiwF


Sample Code


Initialization

In version 1.5

    Outbrain.initializeOutbrainWithConfigFile("OBConfig.plist");

Alternative way to init (available on 1.5.2)

    Outbrain.initializeOutbrainWithPartnerKey("YOUR_PARTNER_KEY");


Fetching Recommendations

let widgetID = "SAMPLE_ID"
let request = OBRequest.init(URL: ViewController.kOBRecommendationLink, widgetID: widgetID)
var responseString = ""
Outbrain.fetchRecommendationsForRequest(request) { (response:OBRecommendationResponse!) -> Void in

    if response.error != nil {
        // TOOD handle error
        return
    }
    else {
        // Here you've gotten a successful response.
        // Loop through the `response.recommendations` and layout your UI
        for recommandation in response.recommendations {
            // Layout UI for this `OBRecommendation`
            responseString += recommandation.content
            responseString += "\n\n"
        }
    }

    self.reponseTextView.text = responseString   
}


Registering a click and Redirecting

let url = Outbrain.getOriginalContentURLAndRegisterClickForRecommendation(recommandation)