Web Analytics

PartitionKit

⭐ 242 stars Simplified Chinese by kieranb662

Partition Kit

partition kit logo

最近登上了十月安卓和iOS十大流行库以及5个提升你应用的iOS库

grid

什么是 PartitionKit?

PartitionKit 不是 什么?

要求

PartitionKit 默认需要 SwiftUI 框架支持,因此仅支持以下平台:

如何添加到你的项目

少于两分钟的教程视频

教程视频:如何使用 PartitionKit

如何使用

垂直分区

`` Swift VPart(top: { MyTopView() }, bottom: { MyBottomView() }) { MyHandle() }

水平分区

  • 决定您希望在“左侧”显示的视图,您希望在“右侧”显示的视图,以及可选的用于拖动分区调整大小的“手柄”。
  • 执行此操作
Swift HPart(left: { MyLeftView() }, right: { MyRightView() }) { MyHandle() }

GridPartition

  • 决定哪些视图将放置在每个角落 TopLeftTopRightBottomLeftBottomRight,以及可选的一个用于用户拖动和调整视图大小的 Handle
  • 执行此操作
Swift GridPart(topLeft: { MyTopLeftView() }, topRight: { MyTopRightView() }, bottomLeft: { MyBottomLeftView() }, bottomRight: { MyBottomRightView() }) { MyHandle() }
## 示例

复制并粘贴此内容,我添加了命名图片以展示视图应有的外观,我使用的是暗模式,因此浅色模式的颜色可能看起来不同。

| H部分 | V部分 | 网格部分 | 嵌套网格 | 混合 | |-------------------------|-------------------------|-------------------------------|----------------------------------------|-----------------------------| | HPart | VPart | GridPart | Nested Grid | Mixed |

Swift import SwiftUI import PartitionKit

struct ContentView: View { var vExample: some View { VPart(top: { RoundedRectangle(cornerRadius: 25).foregroundColor(.purple) }) { Circle().foregroundColor(.yellow) } } var hExample: some View { HPart(left: { RoundedRectangle(cornerRadius: 10).foregroundColor(.blue) }) { Circle().foregroundColor(.orange) } } var nestedExample: some View { VPart(top: { hExample }) { vExample } } var gridExample: some View { GridPart(topLeft: { RoundedRectangle(cornerRadius: 25).foregroundColor(.purple) }, topRight: { Circle().foregroundColor(.yellow) }, bottomLeft: { Circle().foregroundColor(.green) }) { RoundedRectangle(cornerRadius: 25).foregroundColor(.blue) } } var nestedGridsExample: some View { GridPart(topLeft: { gridExample }, topRight: { gridExample }, bottomLeft: { gridExample }) { gridExample } } var body: some View { nestedExample } }

struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } `

待办事项

--- Tranlated By Open Ai Tx | Last indexed: 2026-05-11 ---