找不到类型“ databaseerference”在范围
我正在使用Xcode 13,并且已经设置了将实时数据库与Swift UI应用程序连接的,我希望将数据写入Firebase,但是在此步骤中,我会遇到错误 Here is my to config firebase
import SwiftUI
import Firebase
@main
struct FirebaseDatabaseApp: App {
init(){
FirebaseApp.configure()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
And file contentview.swift
import SwiftUI
import Firebase
struct ContentView: View {
var body: some View {
var ref: DatabaseReference! //I have a err here
Text("Hello, world!")
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I try to create new class on another file but it still not work 我如何实现将数据写入实时数据库的目标, 我正在关注Firebase文档
I am using xcode 13 and I have set up to connect realtime database with swift ui app my wish is to write data to firebase but to this step I am getting error
Here is my to config firebase
import SwiftUI
import Firebase
@main
struct FirebaseDatabaseApp: App {
init(){
FirebaseApp.configure()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
And file contentview.swift
import SwiftUI
import Firebase
struct ContentView: View {
var body: some View {
var ref: DatabaseReference! //I have a err here
Text("Hello, world!")
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I try to create new class on another file but it still not work
how can i achieve the goal of writing data to realtime database,
I was following firebase docs
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论