📜  如何垂直居中滚动视图 swiftui - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:57.939000             🧑  作者: Mango

代码示例1
/// Custom vertical scroll view with centered content vertically
///
struct VScrollView: View where Content: View {
  @ViewBuilder let content: Content
  
  var body: some View {
    GeometryReader { geometry in
      ScrollView(.vertical) {
        content
          .frame(width: geometry.size.width)
          .frame(minHeight: geometry.size.height)
      }
    }
  }
}