📲 如何安装
CocoaPods
使用编辑您的 Podfile
并指定依赖项
pod 'MLCardForm'
🌟 功能
- 易于集成
- PCI 合规性(我们不保存任何信息)
🐒 如何使用
1 - 将其导入到项目中
import MLCardForm
PublicKey
或 PrivateKey
、您的 siteId
和您的 flowId
2 - 创建 MLCardFormBuilder 的实例,使用您的 let builder = MLCardFormBuilder(publicKey: yourPublicKey, siteId: yourSiteId, flowId: yourFlowId, lifeCycleDelegate: self)
MLCardFormLifeCycleDelegate
以收到 MLCardForm 事件的提示。
3 - 实现 extension YourViewController: MLCardFormLifeCycleDelegate {
func didAddCard(cardID: String) {
// The card has been added. You can pop the `MLCardFormViewController` here.
}
func didFailAddCard() {
// There was an error adding the card.
}
}
4 - 使用构建器作为参数获取 MLCardFormViewController 的实例。
let cardFormVC = MLCardForm(builder: builder).setupController()
5 - 将 MLCardFormViewController 的实例推送到栈中。
navigationController?.pushViewController(cardFormVC, animated: true)
💡 高级功能
📈 跟踪
我们提供了 MLCardFormTrackerDelegate
协议来通知每个跟踪事件。您可以使用 MLCardFormConfiguratorManager 订阅此协议。
@objc public protocol MLCardFormTrackerDelegate: NSObjectProtocol {
func trackScreen(screenName: String, extraParams: [String: Any]?)
func trackEvent(screenName: String?, extraParams: [String: Any]?)
}
😉 下一步
- Bitrise 集成
- UI XCtest
- SwiftLint
🔮 项目示例
此项目包括一个使用 MLCardForm
的示例项目。进入路径:card-form-ios/Example
,运行 pod install 命令。之后,您可以打开 Example_CardForm.xcworkspace
。
📋 支持的操作系统和 SDK 版本
- iOS 10.0+
- Swift 5
- xCode 10+
- @Objc 完全兼容
❤️ 反馈
这是一个开源项目,所以请随意贡献。如何? -> 分支此项目并提出您的修复、建议,并提交带有更改的 pull 请求。
👨🏻💻 作者
- Esteban Boffa
- Eric Ertl
- Juan Sanzone
👮🏻 许可证
Copyright 2019 Mercadolibre Developers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.