https://github.com/mustafaibrahim989/MICountryPicker
MICountryPicker is a country picker controller for iOS8+ with an option to search.
https://github.com/mustafaibrahim989/MICountryPicker
Last synced: 5 months ago
JSON representation
MICountryPicker is a country picker controller for iOS8+ with an option to search.
- Host: GitHub
- URL: https://github.com/mustafaibrahim989/MICountryPicker
- Owner: mustafaibrahim989
- License: mit
- Created: 2016-01-16T19:22:44.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-03T00:02:36.000Z (over 5 years ago)
- Last Synced: 2024-11-07T09:02:57.965Z (about 1 year ago)
- Language: Swift
- Homepage:
- Size: 553 KB
- Stars: 90
- Watchers: 12
- Forks: 37
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - MICountryPicker - Swift country picker with search option. (UI / PickerView)
- awesome-ios-star - MICountryPicker - Swift country picker with search option. (UI / PickerView)
- awesome-swift-cn - MICountryPicker - Swift country picker with search option. (Libs / UI)
- fucking-awesome-ios - MICountryPicker - Swift country picker with search option. (UI / PickerView)
README
# 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
  
## Installation
MICountryPicker is available through [CocoaPods](http://cocoapods.org), 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
```swift
let picker = MICountryPicker()
navigationController?.pushViewController(picker, animated: true)
```
## MICountryPickerDelegate protocol
```swift
// delegate
picker.delegate = self
// Optionally, set this to display the country calling codes after the names
picker.showCallingCodes = true
```
```swift
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
```swift
// or closure
picker.didSelectCountryClosure = { name, code in
print(code)
}
picker.didSelectCountryWithCallingCodeClosure = { name, code, dialCode in
print(dialCode)
}
```
## Author
Mustafa Ibrahim, mustafa.ibrahim989@gmail.com
Notes
============
Designed for iOS 8+.
## License
MICountryPicker is available under the MIT license. See the LICENSE file for more info.