Recently I've made 1 character mistake in my code and have hard time during searching what was the problem.
Basically I forgot to set dot near one of the frame modifiers and compiler did not warn me, but during app running I got 100% CPU and rocket increase of RAM (on real app). Feels like recursion, but no any hint in call stack inside Xcode on crash stop.
struct BadView: View {
var body: some View {
Color.red
frame(height: 36)
}
}
I would like to see at least warning for such cases. Problem may look simple on this small example, but if you added 1k+ lines after last compilation - searching this type of errors could be problematic when you have no idea what to search.
I think this is something that SwiftUI could handle internally or trigger a compile-time error for. There should be a safer way to disambiguate between top-level functions, static methods, and instance methods in this case.
Please file a bug report and share the feedback number (FB) once it's submitted. For tips on how to create an effective bug report, you can refer to Bug Reporting: How and Why?