BeeKit
适用于 iOS 开发者的工具包。
任务
- 添加 Carthage、CocoaPods、Swift Package Manager 支持
- 为 Controller 添加路由器
- 创建文档
用法
路由器
根据 URL 获取对象
URLRouter.shared.objectFor(type: UIViewController.Type, url: <#T##URL?#>)
根据 URL 显示 Controller
URLRouter.shared.open(<#T##url: URL?##URL?#>, source: UIViewController.bee.topVisibleViewController(), options: <#T##[String : Any]?#>)
URLRouterable
extension WebViewController: URLRouterableExact {
/** optional
var bee_router: String = "beelink://nativePage/webview"
*/
static func initWith(req request: URLActionRequest) -> UIViewController? {
return WebViewController(request.url)
}
}
URLRouterSchemeAble
extension WebViewController: URLRouterableScheme {
static var bee_scheme: String = "http,https"
static func initWith(req request: URLActionRequest) -> UIViewController? {
return WebViewController(request.url)
}
}
安装
CocoaPods
CocoaPods 1.8.4+建议用于构建BeeKit。
要使用CocoaPods将SnapKit集成到您的Xcode项目中,请在您的Podfile
中指定它
target '<Your Target Name>' do
pod 'BeeKit'
end
替换YOUR_TARGET_NAME,然后在终端中运行pod install
或者在CocoaPods.app中执行。
Carthage
将其添加到Cartfile
github "yaochenfeng/BeeKit"
运行carthage update
来构建框架并将构建的BeeKit.framework
拖放到您的Xcode项目中。
Carthage作为静态库
Carthage默认将BeeKit构建为动态库。
如果您想使用Carthage将BeeKit构建为静态库,可以在构建之前使用以下脚本手动修改框架类型
carthage update RxSwift --platform iOS --no-build
sed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/BeeKit/BeeKit.xcodeproj/project.pbxproj
carthage build BeeKit --platform iOS