Skip to main content

How to fix “Cannot convert value of type '() -> ()' to expected argument type '() -> _'”

About 2 minSwiftSwiftUIArticle(s)bloghackingwithswift.comcrashcourseswiftswiftuixcodeappstore

How to fix “Cannot convert value of type '() -> ()' to expected argument type '() -> _'” 관련

SwiftUI by Example

Back to Home

How to fix “Cannot convert value of type '() -> ()' to expected argument type '() -> _'” | SwiftUI by Example

How to fix “Cannot convert value of type '() -> ()' to expected argument type '() -> _'”

Updated for Xcode 15

This rather confusing error message usually happens because you created a container but forgot to include some content inside it – you were probably just experimenting, and wrote code like this:

VStack {

}

If you just want a placeholder while you’re working on something else, use an EmptyView to keep the compiler happy, like this:

VStack {
    EmptyView()
}
Similar solutions…
How to fix “Cannot convert value of type 'String' to expected argument type 'Binding'” | SwiftUI by Example

How to fix “Cannot convert value of type 'String' to expected argument type 'Binding'”
How to fix “Cannot convert value of type 'String' to expected argument type 'Text'” | SwiftUI by Example

How to fix “Cannot convert value of type 'String' to expected argument type 'Text'”
How to fix “Cannot assign to property: 'self' is immutable” | SwiftUI by Example

How to fix “Cannot assign to property: 'self' is immutable”
How to fix “Missing argument for parameter 'content' in call” | SwiftUI by Example

How to fix “Missing argument for parameter 'content' in call”
How to fix “Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type” | SwiftUI by Example

How to fix “Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type”

이찬희 (MarkiiimarK)
Never Stop Learning.