一个 iOS 模块和组件分离的解决方案。您可以通过 URL 路由到 viewController 或执行原生 block。
IntentCtx.default.register(LoginViewController.self, forKey: "login")
IntentCtx.default.register({ (param) in
print(param)
}, forKey: "showAlert")
let router = try? Router.init(key: "login", extra: ["stringValue": "This message came from a router"])
router?.submit()
var router = try? Router.init(key: "login", extra: ["stringValue": "This message came from a router"])
router?.transition = SystemTransition.init(axis: .horizontal, style: .zoom(factor: 0.8))
router?.submit()
var router = try? Router.init(key: "login", extra: ["stringValue": "This message came from a router"])
router?.config = .present([.fakePush, .wrapNC])
router?.transition = SystemTransition.init(axis: .horizontal, style: .zoom(factor: 0.8))
router?.submit()
let router = try? Router.init(urlString: "router://login?stringValue=This message came from a url string")
router?.submit()
CocoaPods 是一个 Objective-C 的依赖管理器,它自动化并简化了使用第三方库的过程。您可以使用以下命令安装:
$ gem install cocoapods
要使用 CocoaPods 将 JWIntent 集成到您的 Xcode 项目中,请在 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'JWIntent'
然后,运行以下命令:
$ pod install
(MIT 许可证)