ViewControllerDescribable 1.0.2

ViewControllerDescribable 1.0.2

测试测试过
语言语言 SwiftSwift
许可 MIT
发布最后发布2017年6月
SwiftSwift版本3.0
SPM支持SPM

Andrew Kochulab维护。



  • ——————————————————
  • Andrew Kochulab

ViewControllerDescribable

License

在控制器之间切换的简单方式。

只需安装pod,即可立即使用!

要求

  • Swift >= 3.0
  • iOS >= 8.0

安装

CocoaPods

pod 'ViewControllerDescribable'

然后在终端运行以下命令:

pod install

在您的项目中创建一个枚举,如下所示:

extension UIStoryboard {
   enum Name: String, StoryboardNameDescribable {
       case main = "Main",
       profile = "Profile"
   }
}

用法

像这样描述您的视图控制器

import ViewControllerDescribable

extension SecondViewController: ViewControllerDescribable {
   static var storyboardName: StoryboardNameDescribable {
       return UIStoryboard.Name.profile
   }
}

然后从视图控制器中推送或呈现后,您将拥有

navigationController?.push(SecondViewController.self, configuration: { vc in
   vc.firstName = "Hello"
})

present(ThirdViewController.self)

示例

ViewControllerDescribableTest

鸣谢

  • 由Andrew Kochulab编写
  • VK