Leanplum iOS SDK 3.0.0 Swift changes

Leanplum iOS SDK version 3.0.0 releases a number of improvements for Swift.
There are several classes, methods, and parameters that have been changed to be more Swift friendly.

📘

All documentation samples are changed to reflect the Swift improvements in the 3.0.0 release.

Below you can find what changed in version 3.0.0 and what were the declarations previously.
Note that all documentation samples are changed to reflect this release.
Release notes are available in Github.

Set App Id

from:

Leanplum.setAppId("YOUR_APP_ID", withDevelopmentKey:"YOUR_DEVELOPMENT_KEY")
Leanplum.setAppId("YOUR_APP_ID", withProductionKey: "YOUR_PRODUCTION_KEY")

to:

Leanplum.setAppId("YOUR_APP_ID", developmentKey:"YOUR_DEVELOPMENT_KEY")
Leanplum.setAppId("YOUR_APP_ID", productionKey: "YOUR_PRODUCTION_KEY")

Variables

from:

 var welcomeMessage = LPVar.define("welcomeMessage",
    withString: "Welcome to Leanplum!")

to:

 var welcomeMessage = Var(name: "welcomeMessage", string: "Welcome to Leanplum!")

from:

(self.welcomeMessage?.stringValue())!

to:

self.welcomeMessage.stringValue

from:

(showAds?.boolValue())!

to:

showAds.boolValue()

Track

from:

Leanplum.track("Launch")

to:

Leanplum.track(event: "Launch")

from:

Leanplum.track("Score", withValue: 1)
Leanplum.track("Likes", withInfo: post.id)
Leanplum.track("Likes", withParameters:["post":post.id])

Leanplum.trackPurchase(LP_PURCHASE_EVENT, withValue: 5.0, andCurrencyCode: "EUR", andParameters: ["serial" : 12345, "name":"coffee"])

to:

Leanplum.track(event: "Score", value: 1)
Leanplum.track(event: "Likes", info: post.id)
Leanplum.track(event: "Likes", params:["post":post.id])

Leanplum.track(event: LP_PURCHASE_EVENT, value: 5.0, currencyCode: "EUR", params: ["serial" : 12345, "name":"coffee"])

Start Response

from:

Leanplum.onStartResponse { (success:Bool) in
  // Insert code here.
}

to:

Leanplum.onStartResponse { (success) in
  // Insert code here.
}

Advance

from:

Leanplum.advance(to: "Level", withInfo:level.name)

to:

Leanplum.advance(state: "Level", info: level.name)

Start

from:

Leanplum.start(withUserId: "user1234")

to:

Leanplum.start(userId: "user1234")

from:

Leanplum.start(userAttributes: ["gender":"Female", "age": 29])

to:

Leanplum.start(attributes: ["gender":"Female", "age": 29])

App Inbox

from:

LPInboxMessage

to:

LeanplumInbox.Message

from:

Leanplum.inbox().onChanged({
    unreadCountLabel.text = String(Leanplum.inbox().unreadCount())
})

to:

Leanplum.inbox().onInboxChanged {
    unreadCountLabel.text = String(Leanplum.inbox().unreadCount)
}

from:

inbox.count()
inbox.unreadCount()

to:

inbox.count
inbox.unreadCount

from:

let allMessages: [LPInboxMessage] = inbox.allMessages
let unreadMessages: [LPInboxMessage] = inbox.unreadMessages() as! [LPInboxMessage]

to:

let allMessages: [LeanplumInbox.Message] = inbox.allMessages
let unreadMessages: [LeanplumInbox.Message] = inbox.unreadMessages

from:

let message: LPInboxMessage = Leanplum.inbox().message(forId: messageId)
let title: String = message.title()
let subtitle: String = message.subtitle()
let timestamp: Date = message.deliveryTimestamp()

to:

let message: LeanplumInbox.Message = Leanplum.inbox().message(id: messageId)
let title: String = message.title
let subtitle: String = message.subtitle
let timestamp: Date? = message.deliveryTimestamp

from:

message.isRead()

to:

message.isRead

Location accuracy

from:

LPLocationAccuracyCELL

to:

.cell