Update SwiftUI App for iPad, Landscape, and Dark Mode | SwiftUI Map App #8
private let maxWidthForiPad: CGFloat = 700
header
.padding()
.frame(maxWidth: maxWidthForiPad)
maxWidth
를 통해 지원private var locationsPreviewStack: some View {
ZStack {
ForEach(viewModel.locations) { location in
if viewModel.mapLocation == location {
LocationPreviewView(location: location)
.shadow(color: Color.black.opacity(0.3), radius: 20)
.padding()
.frame(maxWidth: maxWidthForiPad)
.frame(maxWidth: .infinity)
.transition(.asymmetric(
insertion: .move(edge: .trailing),
removal: .move(edge: .leading)))
}
}
}
}
maxWidth
를 infinity
로 설정한 부분, 하지만 실제 UI를 그리는 부분은 maxWidthForiPad
로 준 부분