Hello, World!
Hello, World!
Candle is an SDK that provides programmatic read and write access to consumer internet services.
One SDK, countless integrations—leverage existing app data to create personalized UX.
We handle auth and deliver effortless function calls—no fragile browser automation.
1import SwiftUI
2import Candle // STEP 1: Import Candle
3
4struct ContentView: View {
5 @Environment(CandleClient.self) private var client
6 // STEP 2: Add State for sheet
7 @State private var isPresented = false
8 @State private var linkedAccounts: [Models.LinkedAccount] = []
9 @State private var linkedAccount: Models.LinkedAccount?
10
11 var body: some View {
12 NavigationStack {
13 List {
14 ForEach(linkedAccounts) { account in
15 Text("\(account.service.name): \(account.id)")
16 }
17 }
18 .navigationTitle("Linked Accounts")
19 Spacer()
20 Button("Link Account") {
21 isPresented = true
22 }
23 .buttonStyle(.bordered)
24 }
25 // STEP 3: Add sheet 🎉
26 .candleLinkSheet(isPresented: $isPresented) { newLinkedAccount in
27 print("New linked account:", newLinkedAccount.id)
28 linkedAccount = newLinkedAccount
29 }
30 .task(id: linkedAccount) {
31 do {
32 linkedAccounts = try await client.getLinkedAccounts()
33 } catch {
34 print("Error fetching linked accounts:", error)
35 }
36 }
37 }
38}
39
40#Preview {
41 ContentView()
42 .environment(CandleClient(appUser: .init(appKey: "DEBUG_APP_KEY", appSecret: "DEBUG_APP_SECRET")))
43}
44
Every connection you need, packed into one powerful kit.
All product and company names and logos are trademarks™ or registered trademarks® of their respective holders. Their usage does not imply any affiliation with or endorsement by their holders.