How do I position views relative to their top left corner in swiftUI? The "position" modifier moves the views relative to their center coordinates. So .position(x: 0, y: 0)
places a views center coordinate in the top left of the screen.
I want to place a views top left coordinate in the top left of the screen, How do I do this?
struct HomeView: View {
var body: some View {
VStack(alignment: .leading) {
Text("Top Text")
.font(.system(size: 20))
.fontWeight(.medium)
Text("Bottom Text")
.font(.system(size: 12))
.fontWeight(.regular)
}
.position(x: 0, y: 0)
}
}
Currently, the left half of my view is cut off the screen, how do I prevent this? Also, how do I align relative to the safe area?
I miss UIKit πͺ
position()
function works, except I'm aligning from the top left corners instead of the center. β Sherronsherry