Getting started

Requirements

The Newzulu Live SDK for iOS has the following requirements:

  • Swift 3.0 or later
  • iOS 8.0 or later
  • Xcode 8.2 or 8.3

Downloading the SDK

Integrating with Xcode

  1. Copy the Newzulu directory in your project.
  2. On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop NewzuluCore.framework and NewzuluLive.framework from the Newzulu/Build/iOS folder.
  3. On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Add the following contents to the script area below the shell:
"${SRCROOT}/Newzulu/Scripts/copy-frameworks"

Add the paths to the frameworks under “Input Files”:

$(SRCROOT)/Newzulu/Build/iOS/NewzuluCore.framework
$(SRCROOT)/Newzulu/Build/iOS/NewzuluLive.framework

This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.

Using the SDK

Get your server information

The first step is to get your Newzulu Live server information.

You'll need:

  • The server region you want to use: It can be North America, Europe or Australia.
  • The site code of your project.

Please contact us if you're having difficulties finding those information.

Get an authenticator

Newzulu Live does not implement authentication directly. Instead it expects an authenticator to perform the authentication and provide an authenticated session. This enables you to either use an existing authentication mechanism or to implement you own authentication mechanism.

It very likely that your Newzulu Live server uses the default Newzulu Platform authentication. In that case, you can simply obtain an authenticator from the Newzulu Platform iOS SDK.

import NewzuluCore
import NewzuluLive
import NewzuluPlatform

let platformClient = PlatformClient(domain: .europe, vhost: 98)
let email = "user@example.com"
let password = "*****"
let sessionStore = KeychainStore(identifier: "MyApplication")
platformClient.setCredentials(email: email, password: password, sessionStore: sessionStore)
guard let authenticator = platformClient.authenticator else {
    // You forgot to set the credentials
    throw NewzuluError.notAuthenticated()
}

Please consult the documentation of the Newzulu Platform SDK to learn more about the PlatformClient class: Platform SDK.

That authenticator object uses the credentials you supplied to authenticate to Newzulu Platform and automatically renew the authenticated session whenever it expires.

Create the authenticated client

You can now create an instance of AuthenticatedClient that will be used to perform the requests on the Newzulu Live server.

This object should be instantiated only once per connection. Here's how to create it:

let domain: NewzuluLive.Domain = .europe // Replace with your domain
let siteCode = "test"                    // Replace with your site code
let authenticator = ...
let authenticatedClient = NewzuluLive.AuthenticatedClient(
    domain: domain,
    siteCode: siteCode,
    authenticator: authenticator
)

Replace:

  • domain with the actual domain you want to use: .northAmerica, .europe or .australia.
  • siteCode with your Newzulu Live site code.

That's it, you are now ready to access Newzulu Live.

Next steps