Skip to content

Latest commit

 

History

History
80 lines (55 loc) · 3.29 KB

README.md

File metadata and controls

80 lines (55 loc) · 3.29 KB

banner

Release CocoaPods Documentation Codacy Code Quality Swift 4 Compatible Platform License

CocoaPods

pod 'GCCountryPicker'

Implementation

  1. Add GCCountryPicker to your file's import statements.

    import GCCountryPicker
    
  2. Create an instance of GCCountryPickerViewController.

    let countryPickerViewController = GCCountryPickerViewController(displayMode: .withoutCallingCodes)
    
  3. Set the delegate, data source (optional), and navigation title.

    countryPickerViewController.delegate = self
    countryPickerViewController.dataSource = self
    countryPickerViewController.navigationItem.title = "Countries"
    
  4. Embed the country picker view controller in a navigation controller.

    let navigationController = UINavigationController(rootViewController: countryPickerViewController)
    
  5. Present the navigation controller.

    self.present(navigationController, animated: true, completion: nil)
    
  6. Implement GCCountryPickerDelegate.

    func countryPickerDidCancel(_ countryPicker: GCCountryPickerViewController)
    
    func countryPicker(_ countryPicker: GCCountryPickerViewController, didSelectCountry country: GCCountry)
    
  7. Implement GCCountryPickerDataSource if necessary.

    func countryCodes(for countryPicker: GCCountryPickerViewController) -> [String]
    

Documentation

License

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