A country picker view controller for iOS

Related tags

PickerView planet
Overview

Planet

A country picker view controller for iOS.

Installation

CocoaPods

You can use CocoaPods to install Planet by adding it to your Podfile:

platform :ios, '10.0'
use_frameworks!
pod 'Planet'

Manually

  1. Download and drop /Planet folder in your project.
  2. Congratulations!

Example

First, import the library:

 import Planet

Then, create the view controller:

let viewController = CountryPickerViewController()
viewController.delegate = self

after you present it and the user selects a country you will get a callback with the country name, ISO code, and calling code.

func countryPickerViewController(countryPickerViewController: CountryPickerViewController, didSelectCountry country: Country)

Customization

  • You can hide the calling codes by toggling showsCallingCodes.
  • And you can remove the cancel button, for example if you want to present the view controller by pushing it or in a popover by setting showsCancelButton to false.
  • You can show a custom list of countries instead of all countries by supplying a list of ISO codes in the countryCodes property. See the comment in the example project

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
You might also like...
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.

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.

Date picker dialog for iOS
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

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

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

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

Comments
  • Useful API functions

    Useful API functions

    I had need some functionality like getting Country by isoCode and callingCode, when i want to show country image or name that user has selected it before so I create two functions.

    let viewController = CountryPickerViewController()
    let germany = viewController.getCountry(callingCode: "+49")
    let turkey = viewController.getCountry(isoCode: "TR")
    

    Hope this is not just my need :)

    opened by okankocyigit 6
  • Specs satisfying the `Planet` dependency were found, but they required a higher minimum deployment target.

    Specs satisfying the `Planet` dependency were found, but they required a higher minimum deployment target.

    Hi,

    I got this error during pod install with pod Planet

    Specs satisfying the Planet dependency were found, but they required a higher minimum deployment target.

    I'm building for iOS 9 but can only make it work when I set platform to iOS 10 platform :ios, '10.0'

    Thank you

    opened by LouisBorlee 5
  • Fix crash when specified locale provides no country

    Fix crash when specified locale provides no country

    When setting a locale with identifier like "en" or "de" the datasource crashed when force unwrapping the locale's country. To come up with a current country the Locale.current is now used as a fallback (or no current country is used without crash). This fallback logic makes sense when you consider a german user using an only english localized App, so you expect country names formatted in english to be consistent with UI, but current locale is say "de_DE", so germany will still be moved to top of country list.

    opened by hannesoid 3
  • Workaround UISearchController deallocation warning

    Workaround UISearchController deallocation warning

    See http://www.openradar.me/22250107 which results in a warning like: [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7fdecbe03580>)

    opened by hannesoid 0
Releases(0.1.0)
Owner
kWallet
Pay with your phone easily, quickly and securely.
kWallet
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
🎯 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 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
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
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

Chen Zeyu 527 Oct 2, 2022
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
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

Mind Studios 74 Sep 26, 2022