Skip to main content

How to fix “Property declares an opaque return type, but has no initializer expression from which to infer an underlying type”

About 2 minSwiftSwiftUIArticle(s)bloghackingwithswift.comcrashcourseswiftswiftuixcodeappstore

How to fix “Property declares an opaque return type, but has no initializer expression from which to infer an underlying type” 관련

SwiftUI by Example

Back to Home

How to fix “Property declares an opaque return type, but has no initializer expression from which to infer an underlying type” | SwiftUI by Example

How to fix “Property declares an opaque return type, but has no initializer expression from which to infer an underlying type”

Updated for Xcode 15

This usually happens because you accidentally created a view without filling in its contents, like this:

struct DetailView: View {
    var body: some View {

    }
}

If you created that view as a placeholder, just give it so temporary content to make the compiler happy, like this:

struct DetailView: View {
    var body: some View {
        Text("Placeholder")
    }
}
Similar solutions…
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”
How to fix “Referencing initializer 'init(wrappedValue:)' on 'ObservedObject' requires that 'SomeType' conform to 'ObservableObject'” | SwiftUI by Example

How to fix “Referencing initializer 'init(wrappedValue:)' on 'ObservedObject' requires that 'SomeType' conform to 'ObservableObject'”
All SwiftUI property wrappers explained and compared | SwiftUI by Example

All SwiftUI property wrappers explained and compared
How to fix “Initializer 'init(_:rowContent:)' requires that 'SomeType' conform to 'Identifiable'” | SwiftUI by Example

How to fix “Initializer 'init(_:rowContent:)' requires that 'SomeType' conform to 'Identifiable'”
How to fix “Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements” | SwiftUI by Example

How to fix “Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements”

이찬희 (MarkiiimarK)
Never Stop Learning.