I used to be questioning, why some model of code will trigger “Sort ‘()’ can not conform to ‘View'” in Swift UI?
The next code is OK
struct ContentView: View {
var physique: some View {
var a = 100
VStack {
Textual content("Hiya, world!")
}
.padding()
}
}
The next code causes error
struct ContentView: View {
var physique: some View {
var a = 100
a = 999
VStack {
Textual content("Hiya, world!")
}
.padding()
}
}
The code will trigger
Sort '()' can not conform to 'View
Might I do know why it’s so? Is that this restriction imposed by Swift language, or imposed by SwiftUI framework?
My information is in UIKit
, and I’m new to SwiftUI
.
Thanks.