TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Return from initializer without initializing all stored properties

Forums > SwiftUI

Hello,

I am having trouble with fixing this error.

What am i doing wrong here and how can i fix it ?

import FirebaseFirestoreSwift import SwiftUI

struct GrubbView: View { @StateObject var ViewModel = GrubbViewViewModel() @FirestoreQuery var items: [GrubbItem]

private let userId: String

init(userId: String) {
    self.userId = userId

  }                                                                                                                           Return from initializer without initializing all stored properties

var body: some View {
    NavigationView{
        VStack{

        }
        .navigationTitle("Home (Grubb View)")
        .toolbar{
            Button {
                // Action
                ViewModel.showingNewItemView = true
            } label: {
                Image(systemName: "plus")
            }
        }
        .sheet(isPresented: $ViewModel.showingNewItemView) {
            NewItemView(NewItemShown: $ViewModel.showingNewItemView)
        }
    }
}

}

2      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.