CustomSwiftUI 0.2.2

CustomSwiftUI 0.2.2

Lorenzo Fiamingo 维护。



  • Lorenzo Fiamingo

CocoaPods Release

CustomSwiftUI

CustomSwiftUI 努力地补充 SwiftUI 标准库。

何时使用 CustomSwiftUI

CustomSwiftUI 应该涵盖以下情况

  • 某些 SwiftUI API 私有
  • 某些 SwiftUI API 在旧 OS 中不可用
  • 某些 UIKit API 在 SwiftUI 中不可用

内容

视图基础

  • CustomView:如果要将View的body暴露给CustomViewBuilder,请使用CustomView替换bodycustomBody
  • CustomViewBuilder:通过CustomViewBuilder可以检查视图树层次结构(直到遇到ViewBuilder为止)。
  • customTag

列表

  • 自定义forEach

控制和指示器

  • CustomPicker:通过CustomPickerStyle实现选择器样式,并通过polyfills从集合中创建选择器。

绘图和图形

  • customTint:通过customTint可以在环境中设置和检索着色颜色。

设计

CustomSwiftUI的目的是通过确保尽可能多的与SwiftUI库保持一致来扩展SwiftUI库,因此这两个库的API尽可能地匹配。

命名约定

为了避免冲突、确保API发现以及使代码中对自定义SwiftUI API的使用更加清晰,SwiftUI API扩展中的所有顶级结构和方法的名称都必须以Custom开头。例如,要为旧操作系统补全ColorPicker,应创建CustomColorPicker