# iOS

The steps below will integrate ParOne into your iOS app.

    For iOS apps, instantiate a WkWebView object and load our script tag and the single video block.

    Replace YOUR_FEED_ID with your Feed ID, and the CAMPAIGN_ID with a campaign ID from the JSON or RSS feed.

    For ENVIRONMENT, use prod for production and stage for testing.

    ParOne's integration team will tell you which environment to use when.

    class ViewController: UIViewController, WKUIDelegate {
    
        var webView: WKWebView!
    
        override func loadView() {
            let webConfiguration = WKWebViewConfiguration()
            webConfiguration.allowsAirPlayForMediaPlayback = true
            webConfiguration.allowsPictureInPictureMediaPlayback = true
            webView = WKWebView(frame: .zero, configuration: webConfiguration)
            webView.uiDelegate = self
            view = webView
        }
        override func viewDidLoad() {
            super.viewDidLoad()
            webView.loadHTMLString("
            <html>
            <head><script src='https://sdk.parone.io/parone.js'></script></head>
            <body>This is a video test<br>
              <parone-video-block
                env='ENVIRONMENT' 
                feed='YOUR_FEED_ID' 
                campaign='CAMPAIGN_ID'>
              </parone-video-block>
            </html>",
            baseURL: URL(string: "https://www.parone.com"))
        }
    }
    

    DEVELOPMENT NOTE

    In addition, you should add the Audio, AirPlay and Picture in Picture capabilties in your Background modes. For more informaton about how to do this, read Apple's documentation here (opens new window).

    Last Updated: 10/10/2021, 3:19:20 PM