Reading time: 1 min
This quick recipe shows how to set a @StateObject in a SwiftUI View's initializer. Basically, you're trying to do this:
struct MyView: View {
@StateObject private var viewModel: ViewModel
init(someParams: String) {
viewModel = ViewModel(params: someParams)
}
But you keep running i...
Reading 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...