POViewController

Pio 的出色的可自定义 ViewController

POViewControllerUIViewController 的子类,并且易于自定义视图大小和呈现位置。

用法

样式 代码 图像
弹出
class PopUpViewController: POViewController {
    ...
    init() {
        super.init(
            direction: .center,
            viewSize: .init(
                width: .absolute(200),
                height: .fit
            ),
            isSwipeEnabled: false
        )
    }
    ...
}

底部表单
class BottomSheetViewController: POViewController {
    ...
    init() {
        super.init(
            direction: .bottom,
            viewSize: .init(
                width: .full,
                height: .absolute(300)
            ),
            isSwipeEnabled: true
        )
    }
    ...
}

侧边菜单
class SideMenuViewController: POViewController {
    ...
    init() {
        super.init(
            direction: .right,
            viewSize: .init(
                width: .fit,
                height: .full
            ),
            isSwipeEnabled: true
        )
    }
    ...
}

请参考示例项目。

要运行示例项目,请克隆此仓库,然后在 Example 文件夹中打开 Example.xcodeproj

要求

安装

Swift Package Manager (SPM)

要使用 Swift Package Manager (SPM) 安装 POViewController,您可以参考 Apple 发布的教程

  1. 在 Xcode 中,选择 “File” → “Add Packages”
  2. 输入 https://github.com/kyungpyoda/POViewController.git 以添加软件包依赖项。

CocoaPods

pod 'POViewController'

贡献

欢迎任何形式的贡献! 🤗

许可证

POViewController 在 MIT 许可证下可用。有关详细信息,请参阅 LICENSE