"Return from initializer without initializing all stored properties" SwiftUI 错误

"Return from initializer without initializing all stored properties" error in SwiftUI

我正在尝试使用 init() 使导航栏透明,但出现错误 "Return from initializer without initializing all stored properties",我不知道如何解决。这是我的代码:

import SwiftUI

struct DoctorHomePage: View {

    @Binding var shouldPopToRootView : Bool
    @State var hiddingNavBar = true
    @State private var curent: Int? = nil
    @State private var profileSegue: Int? = nil
    @State private var isActive: Bool = false
    let defaults = UserDefaults.standard
    let networkRequest = Network()
    @State var cancelable: AnyCancellable? = nil
    @State var localPatients : [Patients] = []
    @Environment(\.colorScheme) var colorScheme: ColorScheme
    @State private var isShowing = false

    init() {
        UINavigationBar.appearance().backgroundColor = .clear
        UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
    } // I get the error here

    var body: some View {
        NavigationView {
            VStack {
               Text("Hello, World!")
            }
        }
    }
}

您还没有初始化 shouldPopToRootView