BSCountryViewController
系统要求
最低要求:Swift 5.1.0,Xcode 11.0.0,iOS 9.0.0
安装
CocoaPods
BSCountryViewController 通过 CocoaPods 提供使用。要安装它,只需将以下行添加到 Podfile 中
pod 'BSCountryViewController'
Swift 包管理器
Swift 包管理器 是一个用于自动分发 Swift 代码的工具,它集成到了 swift
编译器中。虽然仍处于早期开发阶段,但 Alamofire 支持在其支持平台上使用它。
一旦您设置好 Swift 包,将 Alamofire 添加为依赖项就像将它添加到 Package.swift
文件中的 dependencies
值一样简单。
dependencies: [
.package(url: "https://github.com/Adobels/BSCountryViewController.git", .upToNextMajor(from: "1.0.0"))
]
使用方法
import UIKit
import BSCountryViewController
class ViewController: UIViewController {
@IBAction func didTapPresentCountriesPickerButton() {
let vc = BSCountryViewController()
vc.delegate = self
present(vc, animated: true, completion: nil)
}
}
extension ViewController: BSCountryViewControllerDelegate {
func didSelectRegions(_ regions: [String]) {
debugPrint("--- didSelectRegions ---")
debugPrint(regions)
}
func didTapDoneButton(with regions: [String]?) {
debugPrint("--- didTapDoneButton ---")
debugPrint(regions ?? "regions array is nil")
dismiss(animated: true, completion: nil)
}
}