Open reyamir opened 3 hours ago
I've tried to use Nostr SDK in my SwiftUI app, but when compile, I've got a lot of errors
My simple code:
Init
import SwiftUI import SwiftData import NostrSDK @Observable class Nostr { var client: Client = ClientBuilder.init().database(database: try! NostrDatabase.lmdb(path: "nostr.db")).build(); } @main struct SampleApp: App { @State private var nostr = Nostr() var body: some Scene { WindowGroup { ContentView().environment(nostr) } } }
Just get the nostr state
struct ContentView: View { @Environment(Nostr.self) private var nostr var body: some View { NavigationSplitView { List { } .navigationSplitViewColumnWidth(min: 180, ideal: 200) } detail: { Text("Select an item") } } }
Maybe related to this issue? https://github.com/mozilla/uniffi-rs/issues/2108
I've tried to use Nostr SDK in my SwiftUI app, but when compile, I've got a lot of errors
My simple code:
Init
Just get the nostr state