I am trying to set the content Text("Test.....") inside the scroll view to the top. Without using .frame (maxHeight: 150) and the like. I just need to kick it up under Text ("123")) but nothing comes out. And while scrolling in all directions should work. This is just an example to understand how to do it technically. Guys who can help!
import SwiftUI
struct MainView: View {
var body: some View {
NavigationView {
content
}
.padding()
}
}
private extension MainView {
var content: some View {
VStack {
ZStack(alignment: .topLeading) {
ScrollView([.vertical, .horizontal]) {
Text("TestTestTestTestTestTestTestTestTestTestTest")// set to top in content
.frame(height: 100)
.background(Color.green)
//.position(y: 0)
}
Text("123")
}
.background(Color.blue)
}
}
}