注: SPM 每一个组件最终生成的都是 framwork库 意味着组件存在命名空间(优点)
To run the example project, clone the repo, and run pod install
from the Example directory first.
AprilAlertView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ZPPRouter'
Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
Xcode 11+ is required to build ZPPRouter using Swift Package Manager.
To integrate ZPPRouter into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift
:
dependencies: [
.package(url: "https://github.com/ZPP506/ZPPRouter.git", .upToNextMajor(from: "0.1.1"))
]
public protocol xxxProtocol: UIViewController {
}
extension JLRouteProtocol where Self == ZPPRouter<xxxProtocol> {
@discardableResult
public static func makeDestination(config: ((xxxProtocol) -> Void)) -> xxxProtocol {
let item = makeDestination()
config(item)
return item
}
@discardableResult
public static func makeDestination() -> xxxProtocol {
return UIViewController()
}
}
extension UIViewController: xxxProtocol {}
let vc = ZPPRouter<xxxProtocol>.makeDestination()
或者
ZPPRouter<xxxProtocol>.makeDestination {
$0.view.backgroundColor = .red
}
Dome: https://github.com/ZPP506/ZPPRouter
link |
Stars: 6 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics