Hello I got an console error, while my view are back from NavigationLink. I looked for some solutions but this - https://developer.apple.com/forums/thread/670967 doesn't help me. Any ideas what generate this error? Application doesn't crash, but im interested in what provide this error.
import SwiftUI
struct AddictionListView: View {
@StateObject private var addictionListVM: AddictionListViewModel = AddictionListViewModel()
init() {
UINavigationBar.appearance().barTintColor = UIColor(named: "BackgroundMain")
}
var body: some View {
NavigationView {
ZStack {
Color("BackgroundMain").ignoresSafeArea(.all)
ScrollView {
LazyVStack {
ForEach(addictionListVM.addictions) { addiction in
NavigationLink(destination: Text(addiction.name)) {
AddictionCellView(addiction: addiction)
}.buttonStyle(PlainButtonStyle())
}
}.padding()
}
VStack {
Spacer()
HStack {
Spacer()
NavigationLink(
destination: AddNewAddictionView(),
label: {
Image(systemName: "plus").foregroundColor(.white).font(.title)
})
.frame(width: 50, height: 50, alignment: .center)
.background(Color.green.opacity(0.8))
.clipShape(Circle())
.padding(25)
}
}
}
.navigationBarTitle("Habit tracker!", displayMode: .inline)
}
.onAppear(perform: addictionListVM.createExampleAddictions)
}
}
Selecting any option will automatically load the page