Latest 0.0.2
Homepage https://github.com/salvonos/CityPicker
License MIT
Platforms ios 8.0, requires ARC
Authors

CityPicker

Language
CI Status
Version
Mit License
Platform

Requirements

Swift 2.0
iOS 8.0 +

CityPicker
CityPicker

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like CityPicker in your projects. See the Get Started section for more details.

Podfile

use_frameworks!

pod "CityPicker"

If you like to live on the bleeding edge, you can use the master branch with:

pod 'CityPicker', :git => 'https://github.com/salvonos/CityPicker'

Manually

  1. Clone, add as a submodule or download
  2. Add all the files under Classes to your project.
  3. Enjoy.

Usage

Copy the countriesToCities.json file into the CityPicker Pods Bundle Resources.

1) Select Pods from the Project Navigator

2) Select Target CityPicker

3) Select tab Build Phases

4) In Copy Bundle Resources import the json file countriesToCities.json from resorces folder

!!You must repeat these steps every time a pod is installed or updated

CityPicker

Import CityPicker in proper place.

import CityPicker

CityPicker is designed to be extremely easy to use. First create an instance of class CityPickerViewController, and then call it whenever you need it.

let cityPicker = CityPickerViewController()
@IBAction func showCityPicker(sender: AnyObject) {

        self.cityPicker.showCityPicker(self, backgroundColor: UIColor.clearColor(), blurView_hidden: false)
}

Delegate

The Delegate has 3 required functions. First add the CityPickerViewControllerDelegate in your class and you are ready to receive the selected values in your own class.

CityPickerDidSelectRow:
func CityPickerDidSelectRow(nation: String, city: String) {
        print("(nation), (city)")
    }
CityPickerDidPressedCancelButton:
func CityPickerDidPressedCancelButton() {
        print("canceled")
    }
CityPickerDidPressedSelectButton
func CityPickerDidPressedSelectButton(CityPicker: CityPickerViewController, nation: String, city: String) {
        cityLabel.text = "(city), (nation)"
    }

To Do

  • Support OS X
  • Convert UTF8 symbols in json List
  • Add missing cities

Contact

  • If you have some advice or you want to add a missing city open an issue or a PR.
  • Email [Salvo Nostrato](mailto: [email protected]?subject=CityPicker)

Author

Salvo Nostrato, [email protected]

License

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

Latest podspec

{
    "name": "CityPicker",
    "version": "0.0.2",
    "summary": "Custom Picker View for picking Cities and Countries worldwide",
    "description": "CityPicker is a customizable Picker View for picking almost all Cities in the world. The list is still being updated. Background and Visual Effect Views are customizable.",
    "homepage": "https://github.com/salvonos/CityPicker",
    "license": "MIT",
    "authors": {
        "salvonos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/salvonos/CityPicker.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "CityPicker": [
            "Pod/Assets/*.json"
        ]
    }
}

Pin It on Pinterest

Share This