SwiftUI) GeometryReader에 대해서 알아보자
·
앱/SwiftUI
우선 GeometryReader가 도큐먼트에 쓰여있는 정의를 번역하자면, GeometryReader는 그 자체로 ‘View’이며, container 안 View 스스로의 크기와 위치를 함수로 정의한다고 소개되어있다.GeometryReader를 사용하지 않는 코드struct ContentView: View { @State var isPresented = false var body: some View { VStack { Text("this is View") .padding() RightView() } } } struct RightView: View { var body: some View { Rectangle().foregroundColor(.blue) } }처음뷰는 기존의 VStack을 사용하는 방법과 동일..