22
Jan
2021
How to fix "Function declares an opaque return type, but the return statements in its body do not have matching underlying types" error.
swiftui error anyview opaqueReading time: 3 min
Here's a quick tip for resolving a common and annoying error that you'll occasionally see. The error message is
Function declares an opaque return type, but the return statements in its body do not have matching underlying types
and you can see it if you declare a function or a property that returns some View
and the body has multiple returns.
Search our recipes
Check out the companion apps!
Our free companion app and XCode Extension brings 100+ SwiftUI recipes right at your fingertips! Get a preview of it in the Online Companion.
Have a recipe for us?
Get in touch and let's grow the cookbook together!