Reputation: 1543
I am fairly new to SwiftUI and am building a Widget, but I cannot figure out how to pin an image to the top of a view, this is what I've tried but it just defaults to the center of the widget, how can I pin it to the top?
var body: some View {
Image("nav_logo")
.edgesIgnoringSafeArea(.top)
}
Upvotes: 1
Views: 1029
Reputation: 30318
Use a VStack
and Spacer
.
var body: some View {
VStack {
Image("nav_logo")
.edgesIgnoringSafeArea(.top)
Spacer() /// will push the image up
}
}
Upvotes: 1