All integrations
Swift + ParseAPI

Swift. Make your first call.

Install the official Swift client and bring ParseAPI into your app.

Official Swift SDK

Swift install
.package(url: "https://github.com/parseapi/swift", from: "1.8.0")

Your language. The same ParseAPI.

Get connected

One country. Your first request.

Look up the United States and print its name.

01

Install the library.

Add the ParseAPI product to your app target. In Xcode, you can also add the repository URL through Add Package Dependencies.

Package.swift dependency
.package(url: "https://github.com/parseapi/swift", from: "1.8.0")
02

Add your app key.

Create an app key in Keys and allow your bundle identifier. Replace parse_app_... in the example.

The SDK sends your bundle identifier automatically. Carrier, HLR and Email mailbox verification require a secret key on your server.

03

Make a request.

Add this function to your app, then call it from an async task. This lookup uses your plan's request allowance.

Swift app code
import ParseAPI

func loadCountry() async throws {
    let parse = try ParseAPI("parse_app_...")
    let country = try await parse.country("US")
    print(country.name)
}

// Call from your app's async task.
// try await loadCountry()
Expected outputUnited States
Handle API errors

Read the error code and request ID when an API request fails. Branch on the code, such as not_found, rather than the message. A response with valid: false is a successful lookup. Transport failures still propagate.

Swift app code with error handling
import ParseAPI

func loadCountry() async throws {
    let parse = try ParseAPI("parse_app_...")
    do {
        let country = try await parse.country("US")
        print(country.name)
    } catch let error as ParseAPIError {
        print(error.code, error.status, error.requestId ?? "")
        throw error
    }
}

// Call from your app's async task.
// try await loadCountry()
Requests and retries

SDK methods follow the API routes. Unknown response values stay unknown, rather than becoming empty strings or guesses.

Ordinary lookups retry temporary failures. Separately metered checks make one attempt by default. You can configure the retry count. See the retry policy.

Build with a working example