I prefer the coding style below. (Of course, the code below is not long, but when the number of lines is long)
struct ContentView: View {
var body: some View {
VStack {
text
hello
}
}
var text: some View {
Text("text")
.padding()
}
var hello: some View {
Button("hello") {
print("hello")
}
}
}
But people seem to prefer the style below.(Not only when the number of lines of code is small, but also when it is long)
struct ContentView: View {
var body: some View {
VStack {
Text("text")
.padding()
Button("hello") {
print("hello")
}
}
}
}
Which coding style is more popular among the two?