Pretty sure this is a no-no, but asking just in case there's an easy way to make this work
struct DocumentContentView: View {
private static let logger = Logger(
subsystem: "mySubsystem",
category: String(describing: Self.self)
)
var body: some View {
VStack {
Text("Hello")
logger.trace("hello")
}
}
}
This code generates the following compile error at the logger.trace
line
buildExpression is unavailable: this expression does not conform to View
I suspect every line of the body var
(or any @ViewBuilder
- designated code?) needs to 'return' a View.
Is this correct? or more importantly any work arounds other than putting some/all of the view contents in a. func()?