struct ContentView: View {
var body: some View {
VStack(alignment: .leading, content: {
Text("Hello world!")
.background(.blue)
.alignmentGuide(.leading, computeValue: { dimension in
return 20
})
Text("This is some other text!")
.background(.red)
})
.background(.orange)
}
}
struct ContentView: View {
var body: some View {
VStack(alignment: .leading, content: {
Text("Hello world!")
.background(.blue)
.alignmentGuide(.leading, computeValue: { dimension in
return 0
})
Text("This is some other text!")
.background(.red)
})
.background(.orange)
}
}
struct ContentView: View {
var body: some View {
VStack(alignment: .leading, content: {
Text("Hello world!")
.background(.blue)
.alignmentGuide(.leading, computeValue: { dimension in
return dimension.width
})
Text("This is some other text!")
.background(.red)
})
.background(.orange)
}
}
https://swiftui-lab.com/alignment-guides/
'SwiftUI' 카테고리의 다른 글
사용자한테 보여줄 색깔 선택하기 (0) | 2024.04.23 |
---|---|
Custom tab bar (0) | 2024.04.22 |
Combine 이용해서 API로 JSON 다운받기 (0) | 2024.04.21 |
싱글톤 (1) | 2024.04.19 |
NSCache 인터넷으로 가져온 데이터 캐시에 임시 저장하기 (0) | 2024.04.19 |