CountrySource
提供世界上所有国家的列表(名称、代码、电话代码)并确定当前国家。
需求
- iOS 9.0 或更高版本
- Xcode 11.0 或更高版本
安装
使用 CocoaPods 安装
pod 'CountrySource', '1.2'
构建项目
此时,您的 workspace 应该能够无错误地构建。如果您遇到问题,请发布到 Issue,社区可以帮您解决。
如何使用
import CountrySource
获取当前国家
CountrySource().currentCountry { result in
switch result {
case .success(let country):
print(country.code, country.name, country.dialCode)
case .failure(let error):
print(error)
}
获取所有国家
CountrySource().allCountries { result in
switch result {
case .success(let countries):
print(countries)
case .failure(let error):
print(error)
}
}
作者
通讯
- 如果你发现了错误,请打开一个问题。
- 如果你有功能请求,请打开一个问题。
- 如果你想
贡献力量,提交一个拉取请求。
授权
所有源代码均受MIT 许可协议许可。