CountryKit

Swift 5.0 Platforms

Carthage Compatible CocoaPods Compatible

CountryKit

GitHub release

一个 Swift 微型库,包含所有国家/地区的信息,包括本地化名称、ISO 代码、电话区号、国家/地区代码、国旗图片和 Emoji。

要求

文档

文档 在线可用

http://www.alemar11.org/CountryKit/

安装

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理工具。您可以使用以下命令安装它

$ gem install cocoapods

构建 CountryKit 1.0.0+ 需要 CocoaPods 1.1.0+。

要使用 CocoaPods 将 CountryKit 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'CountryKit', '~> 2.0.1'
end

然后,运行以下命令

$ pod install

Carthage

Carthage 是一个去中心化的依赖管理工具,它可以构建您的依赖项并为您提供二进制框架。

您可以使用 Homebrew 使用以下命令安装 Carthage

$ brew update
$ brew install carthage

要使用 Carthage 将 CountryKit 集成到您的 Xcode 项目中,请在您的 Cartfile 中指定它

github "alemar11/CountryKit" ~> 2.0.1

运行 carthage update 来构建框架,并将构建的 CountryKit.framework 拖到您的 Xcode 项目中。

手动

如果您不想使用上述任何依赖管理工具,您可以手动将 CountryKit 集成到您的项目中。

嵌入式框架

$ git init
$ git submodule add https://github.com/alemar11/CountryKit.git

用法

import CountryKit

let countryKit = CountryKit()

// list of all countries
let countries = countryKit.countries

// the system current country
let country = countryKit.current 

// search a country by its ISO code:
let italy = countryKit.searchByIsoCode("IT")

// iterate over the countries with an iterator:
let iterator = countryKit.makeIterator()

许可证

License MIT)

CountryKit 在 MIT 许可下发布。 有关详细信息,请参阅 LICENSE

贡献

欢迎提交 Pull Request!
用 ★ 显示您的 ❤