A μlibrary in Swift containing all the countries with their localized name, ISO code, phone code, country code, flag image and emoji.

Overview

CountryKit

Swift 5.0 Platforms

Carthage Compatible CocoaPods Compatible

CountryKit

GitHub release

A μlibrary in Swift containing all the countries with their localized name, ISO code, phone code, country code, flag image and emoji.

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 10.2
  • Swift 5.0

Documentation

Documentation is available online.

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

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build CountryKit 1.0.0+.

To integrate CountryKit into your Xcode project using CocoaPods, specify it in your 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

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate CountryKit into your Xcode project using Carthage, specify it in your Cartfile:

github "alemar11/CountryKit" ~> 2.0.1

Run carthage update to build the framework and drag the built CountryKit.framework into your Xcode project.

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate CountryKit into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
  • Add CountryKit as a git submodule by running the following command:
$ git submodule add https://github.com/alemar11/CountryKit.git
  • Open the new CountryKit folder, and drag the CountryKit.xcodeproj into the Project Navigator of your application's Xcode project.

    It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

  • Select the CountryKit.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.

  • In the tab bar at the top of that window, open the "General" panel.

  • Click on the + button under the "Embedded Binaries" section.

  • You will see two different CountryKit.xcodeproj folders each with two different versions of the CountryKit.framework nested inside a Products folder.

    It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom CountryKit.framework.

  • Select the top CountryKit.framework for iOS and the bottom one for macOS.

    You can verify which one you selected by inspecting the build log for your project. The build target for CountryKit will be listed as either CountryKit iOS, CountryKit macOS, CountryKit tvOS or CountryKit watchOS.

Usage

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

License MIT)

CountryKit is released under the MIT license. See LICENSE for details.

Contributing

Pull requests are welcome!
Show your with a ★

You might also like...
Elegant and Easy-to-Use iOS Swift Date Picker
Elegant and Easy-to-Use iOS Swift Date Picker

D2PDatePicker Example To run the example project, clone the repo, and run pod install from the Example directory first. Example Code: Programmatical I

Multi-picker for iOS and Mac available in SwiftUI
Multi-picker for iOS and Mac available in SwiftUI

Multi-picker for iOS and Mac available in Swift UI

iOS/macOS media picker for importing images and videos in SwiftUI

iOS/macOS media picker for importing images and videos in SwiftUI.

A simple yet customizable horizontal and vertical picker view
A simple yet customizable horizontal and vertical picker view

WheelPicker A simple yet customizable horizontal and vertical picker view Features Vertical or Horizontal picker Image or Text data Configure UILabel

LocationPicker - A ready for use and fully customizable location picker for your app
LocationPicker - A ready for use and fully customizable location picker for your app

LocationPicker A ready for use and fully customizable location picker for your app. Features Installation Cocoapods Carthage Swift Package Manager Qui

🔸 A customizable alternative to UIPickerView in Swift.
🔸 A customizable alternative to UIPickerView in Swift.

PickerView PickerView is an easy to use and customize alternative to UIPickerView written in Swift. It was developed to provide a highly customizable

A fully customizable iOS Horizontal PickerView library, written in pure swift
A fully customizable iOS Horizontal PickerView library, written in pure swift

ADDatePicker is Horizontal Date Picker Library written in Swift Requirements Communication Installation Usage Demo Customization Credits License Requi

Countries - The application lists countries parsed from GeoDB Cities API and lets the user see the details of countries
Countries - The application lists countries parsed from GeoDB Cities API and lets the user see the details of countries

Countries The application lists countries parsed from GeoDB Cities API and lets

Countries - Simple iOS Project for search on Countries

Do like Countries 🏴‍☠️ Simple iOS Project for search on Countries The project c

Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings)

Swift .csv parser Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings). Par

Convert Countries, Country Codes, Continents,... with a single line of code.
Convert Countries, Country Codes, Continents,... with a single line of code.

iOS · macOS · watchOS · tvOS A pure Swift library that allows you to easily convert Countries to Country Codes and Country Codes to Countries. There i

Swiftly convert country codes and cultural terms to all 269 emoji flags without hassle
Swiftly convert country codes and cultural terms to all 269 emoji flags without hassle

Swiftly convert country codes and cultural terms to all 269 emoji flags without hassle

A simple, customizable Country picker for picking country or dialing code. 🇮🇳 🇯🇵 🇰🇷 🇩🇪 🇨🇳 🇺🇸 🇫🇷 🇪🇸 🇮🇹 🇷🇺 🇬🇧
A simple, customizable Country picker for picking country or dialing code. 🇮🇳 🇯🇵 🇰🇷 🇩🇪 🇨🇳 🇺🇸 🇫🇷 🇪🇸 🇮🇹 🇷🇺 🇬🇧

CountryPicker A simple, customizable Country picker for picking country or dialing code. This library is for country picker used in many app for selec

 🎯 Swift country and phone code Picker
🎯 Swift country and phone code Picker

CountryPicker Picker code Swift 3 / 4 / 5. Example To run the example project, clone the repo, and run pod install from the Example directory first. U

Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...

Alerts & Pickers Advanced usage of native UIAlertController with TextField, TextView, DatePicker, PickerView, TableView, CollectionView and MapView. F

Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...

Alerts & Pickers Advanced usage of native UIAlertController with TextField, TextView, DatePicker, PickerView, TableView, CollectionView and MapView. F

FaceLibrary - Challenge on day 77/78, creating an application where you can name a photo from library so, you wont forget the peoples name VCore is a Swift collection containing objects, functions, and extensions that I use for all my projects
VCore is a Swift collection containing objects, functions, and extensions that I use for all my projects

VCore Table of Contents Description Library Structure Architecture Gateway Demo Installation Versioning Contact Description VCore is a Swift collectio

Provides API access to localized musical instruments and their tunings.

instruments.fyi instruments.fyi provides API access to localized musical instruments and their tunings provided by InstrumentKit. Table of Contents Wo

Comments
  • resulting CountryKit.framework is almost 100mb

    resulting CountryKit.framework is almost 100mb

    I believe there should be a notice somewhere in the readme as people may use this library in mobile app context where such size is absolutely unacceptable.

    opened by shengchalover 3
  • Country errors

    Country errors

    Hi,

    Country(name: "French Guiana", iso: "GF", phoneCode: 594, countryCode: 254), Country(name: "French Polynesia", iso: "PF", phoneCode: 689, countryCode: 258), Country(name: "French Southern Territories", iso: "TF", phoneCode: nil, countryCode: 260),

    Are french departments, not country !

    Why doesn't use the real list of world countries ?

    https://www.worldometers.info/geography/how-many-countries-are-there-in-the-world/

    opened by DevulderJeanPaul 0
Releases(2.0.2)
Countries - Simple iOS Project for search on Countries

Do like Countries ??‍☠️ Simple iOS Project for search on Countries The project c

Amir Ardalan 0 Feb 27, 2022
Convert Countries, Country Codes, Continents,... with a single line of code.

iOS · macOS · watchOS · tvOS A pure Swift library that allows you to easily convert Countries to Country Codes and Country Codes to Countries. There i

Novem 1 Feb 22, 2022
A simple, customizable Country picker for picking country or dialing code. 🇮🇳 🇯🇵 🇰🇷 🇩🇪 🇨🇳 🇺🇸 🇫🇷 🇪🇸 🇮🇹 🇷🇺 🇬🇧

CountryPicker A simple, customizable Country picker for picking country or dialing code. This library is for country picker used in many app for selec

Suryakant 243 Dec 8, 2022
🎯 Swift country and phone code Picker

CountryPicker Picker code Swift 3 / 4 / 5. Example To run the example project, clone the repo, and run pod install from the Example directory first. U

null 207 Dec 22, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
A country picker view controller for iOS

Planet A country picker view controller for iOS. Installation CocoaPods You can use CocoaPods to install Planet by adding it to your Podfile: platform

kWallet 71 Jul 11, 2022
MICountryPicker is a country picker controller for iOS8+ with an option to search.

MICountryPicker MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 coun

Mustafa Ibrahim 90 Mar 27, 2021
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

Blue Apron 883 Nov 28, 2022
FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

null 10 Dec 11, 2022
A drop in single image picker.

PHSingleImagePicker A low memory, single image picker wrapper that provide a significant smaller file size while also preserve high image quality. Int

Phanith NY 0 Nov 6, 2021