Manual for SWIFT apps

Embedding to Swift apps

First, download the library from HERE

For integration libAdman.a with your Swift app please follow next steps:

  • Include files from archive to active Xcode project

  • Add Objective-C bridging header and include all .h files from the library archive

  • Add next line to Library search path in build settings:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include

Please note, that you will find three libraries in the archive:

  • libAdman - this library is not linked with AFNetworking and/or SocketRocket

  • libAdman_SR - this library is linked with SocketRocket

  • libAdman_AF30 - thisl ibrary is linked AFNetworking and SocketRocket

Please find the one you need, rename it to libAdman.a and add to your project.

Swift example

import UIKit
class ViewController: UIViewController, AdmanDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let adm = Adman.sharedManagerWithSiteId(1013, region: .regionDemo, testMode: false)
adm.delegate = self
adm.prepare()
}
func stateDidChange(sender: Adman) {
switch sender.state {
case .ReadyForPlayback:
sender.showDefaultView(self)
break
default:
break
}
}
func viewClosed() {}
func bannerTouched(urlToNavigate: String!) {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}