rust-nostr / nostr-sdk-swift

Nostr SDK - Swift Package
MIT License
10 stars 3 forks source link

Compile Errors #3

Open reyamir opened 3 hours ago

reyamir commented 3 hours ago

I've tried to use Nostr SDK in my SwiftUI app, but when compile, I've got a lot of errors

Screenshot 2024-11-15 at 10 16 37

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")
      }
  }
}
reyamir commented 3 hours ago

Maybe related to this issue? https://github.com/mozilla/uniffi-rs/issues/2108