Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 885 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 885 Bytes

appwrite-swift-sdk-demo

Sample usage of Appwrite Swift SDK.

First add AppwriteSwiftSDK dependency in Package.swift:

    .package(name: "AppwriteSwiftSDK", url: "https://github.com/armino-dev/appwrite-swift-sdk.git", from: "0.6.4"),
    ],

Then in your main.swift:

import Foundation
import AppwriteSwiftSDK

var client: Client = Client()

client    
    .setProject(value: "your_project_id_here")
    .setEndpoint(endpoint: "http://localhost/v1")
    .setKey(value: "your_api_key_here")
    .setMode(value: "admin")

let users: Users = Users(client: client);


var result: [Any] = users.listUsers()


let r1: [String: Any] = result[0] as! [String : Any]
print("Records: ", r1["sum"] as Any)

let r2 = r1["users"] as! Array<Any>

for r3 in r2 {
    let r4: [String: Any] = r3 as! [String: Any]
    for (k, v) in r4 {
        print("\(k) = \(v)")
    }
}