Git Product home page Git Product logo

countrylist's Introduction

CountryList

A simple iOS framework that allows developers to present a list of countries.

Swift Version Build Status License CocoaPods Platform

CountryList makes it easy to present the user with a list of Countries and their respective information, like country code, phone extension and flag.

Contents

Requirements

  • iOS 9.0+
  • Xcode 7.3+

Installation

CocoaPods

You can use CocoaPods to install CountryList by adding this to your Podfile:

use_frameworks!
pod 'CountryList'

If you get the Unable to find a specification for `CountryList`. error after running pod install.

Run the following commands on your project directory:

pod repo update
pod install

Manually

  1. Drag and drop CountryList.swift Countries.swift Country.swift CountryCell.swift in your project.
  2. That's it!

Usage

  1. Import CountryList module to your ViewController class
import CountryList
  1. Add CountryList to ViewController, then set the delegate for it to self.
class ViewController: UIViewController {

        var countryList = CountryList()

        override func viewDidLoad() {
                super.viewDidLoad()

                countryList.delegate = self
        }
}
  1. Conform your ViewController to CountryListDelegate protocol and implement all the methods, e.g.
class ViewController: UIViewController, CountryListDelegate {

        func selectedCountry(country: Country) {
                print(country.name)
                print(country.flag)
                print(country.countryCode)
                print(country.phoneExtension)
        }
}
  1. Present the CountryList view on ViewController e.g.
class ViewController: UIViewController {

        @IBAction func presentCountryList(_ sender: Any) {
            let navController = UINavigationController(rootViewController: countryList)
            self.present(navController, animated: true, completion: nil)
        }
}
  1. CountryList works with default implementation. Override it to customize its behavior

Notes

  • Landscape mode is not supported

Contribute

Contributions are welcomed! There are however certain guidelines you must follow when you contribute:

  • Have descriptive commit messages.
  • Make a pull request for every feature (Don't make a pull request that adds 3 new features. Make an individual pull request for each of those features, with a descriptive message).
  • Don't update the example project, or any other irrelevant files.

License

Distributed under the MIT license. See LICENSE for more information.

countrylist's People

Contributors

t0mball avatar joeljuarez avatar juanpablofernandez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.