Skip to content

Quick Start

Tianyong Tang edited this page Jun 1, 2016 · 2 revisions

After installation, you can experience LeanCloud Swift SDK now.

Firstly, you need create an LeanCloud application at LeanCloud Console.

Use the application ID and application key to initialize LeanCloud Swift SDK in AppDelegate.swift:

/* Use application ID and application key to initialize SDK. */
LeanCloud.initialize(applicationID: YOUR_APPLICATION_ID, applicationKey: YOUR_APPLICATION_KEY)

Then, you can enjoy service of LeanCloud. Let us save an object to LeanCloud application. Put following code in proper place:

/* Create an object. */
let object = LCObject()

/* Save the object to LeanCloud application. */
object.save { result in
    switch result {
    case .Success: print("Success")
    case .Failure: print("Failure")
    }
}

Build and run application. If everything is OK, the object is successfully saved to LeanCloud application.

For more interesting usage, see LeanCloud documentation.

Clone this wiki locally