MICountryPicker is a country picker controller for iOS8+ with an option to search.

Overview

MICountryPicker

MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 country code standard (http://en.wikipedia.org/wiki/ISO_3166-1). Also and the library includes a set of 250 public domain flag images from https://github.com/pradyumnad/Country-List.

Screenshots

alt tag alt tag alt tag

Installation

MICountryPicker is available through CocoaPods, to install it simply add the following line to your Podfile:

# Swift 3
use_frameworks!
pod 'MICountryPicker', :git => 'https://github.com/mustafaibrahim989/MICountryPicker.git', :branch => 'master'

# Swift 2
use_frameworks!
pod 'MICountryPicker', :git => 'https://github.com/mustafaibrahim989/MICountryPicker.git', :branch => 'swift-2'

Show MICountryPicker from UIViewController

let picker = MICountryPicker()
navigationController?.pushViewController(picker, animated: true)

MICountryPickerDelegate protocol

// delegate
picker.delegate = self

// Optionally, set this to display the country calling codes after the names
picker.showCallingCodes = true
func countryPicker(picker: MICountryPicker, didSelectCountryWithName name: String, code: String) {
        print(code)
}

func countryPicker(picker: MICountryPicker, didSelectCountryWithName name: String, code: String, dialCode: String) {
        print(dialCode)
}

Closure

// or closure
picker.didSelectCountryClosure = { name, code in
        print(code)
}

picker.didSelectCountryWithCallingCodeClosure = { name, code, dialCode in
        print(dialCode)
}

Author

Mustafa Ibrahim, [email protected]

Notes

Designed for iOS 8+.

License

MICountryPicker is available under the MIT license. See the LICENSE file for more info.

You might also like...
a picker view shown as a popup for iOS in Objective-C
a picker view shown as a popup for iOS in Objective-C

CZPicker Demo Change Log 3 most recent changes are listed here. Full change logs v0.4.3 - 2016-08-12 Added - (void)czpickerViewWillDisplay:(CZPickerVi

An iOS picker view to serve all your
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

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 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

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

React-native-place-picker: Pick any place with single click 🚀
React-native-place-picker: Pick any place with single click 🚀

React-native-place-picker: Pick any place with single click 🚀

A SwiftUI implementation of a picker that also allows direct input.
A SwiftUI implementation of a picker that also allows direct input.

ComboPicker ComboPicker is a SwiftUI view that allows users to input a value by selecting from a predefined set or by typing a custom one. Installatio

Comments
  • Cannot understand the purpose of popToRootViewcontroller?

    Cannot understand the purpose of popToRootViewcontroller?

    extension MICountryPicker {

    override public func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
        let country: MICountry!
        if searchController.searchBar.isFirstResponder() {
            country = filteredList[indexPath.row]
        } else {
            country = sections[indexPath.section].countries[indexPath.row]
    
        }
        delegate?.countryPicker(self, didSelectCountryWithName: country.name, code: country.code)
        didSelectCountryClosure?(country.name, country.code)
        navigationController?.popToRootViewControllerAnimated(true)
    }
    

    }

    I think it it should be either pop to previous or dismissviewcontroller depending upon app's behaviour

    enhancement 
    opened by TheEngineerz 2
  • Country Picker with added calling codes.

    Country Picker with added calling codes.

    Greetings, I forked your repo and added country calling codes information to it. Would you be interested in a pull request with this work ( plus all the adjustments you see necessary ) to be sent upstream?

    opened by phowat 1
  • fix wrong title header when search

    fix wrong title header when search

    I see that your pods display a wrong title header when I type another character on search bar. For example, I type "J" and then the title header is still "A"

    opened by tin612 0
Releases(0.2.2)
Owner
Mustafa Ibrahim
Mustafa Ibrahim
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
🎯 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 SwiftUI List Picker to replace system Picker in List

BetterListPicker An alternative customizable list picker in order to replace built-in non customizable Picker when we write settings view codes. Demo

Jinya 1 Apr 11, 2022
A better SwiftUI Picker Use _Picker instead of Picker

BetterPicker A better SwiftUI Picker. Use _Picker instead of Picker. Create styles with _PickerStyle. The is a WIP This library is currently a work-in

Eric Lewis 17 Dec 14, 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
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 μlibrary in Swift containing all the countries with their localized name, ISO code, phone code, country code, flag image and emoji.

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

Alessandro 24 Nov 11, 2021
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
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
Date picker dialog for iOS

DatePickerDialog 4.0 - iOS - Swift DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView. Requirements DatePic

Squimer 535 Dec 17, 2022