The HomeView()struct is not able to call in function or in button action. How should i call the HomeView() struct from another struct. While calling HomeView() either in button action or function of LoginView() , am getting "Result of 'HomeView' initializer is unused"
struct LoginView: View
{
var body: some View
{
}
func login()
{
HomeView() //Result of 'HomeView' initializer is unused "WARNING"
}
}
struct LoginView: View
{
var body: some View {
NavigationView {
VStack
{
Button(action: {
HomeView() //Result of 'HomeView' initializer is unused "WARNING"
})
{
HStack(alignment: .center) {
Spacer()
Text("Submit")
}
}
}
}
}
}
struct HomeView: View
{
var body: some View
{
}
func submit()
{
}
}
HomeView()is not a function, it is constructor of value, likelet view = HomeView()