Latest 0.1.2
Homepage https://github.com/lucabecchetti/CountriesViewController
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit, Foundation, CoreData
Authors

CountriesViewController – A view controller that allow user to select a countries. It supports single or multiple selection

CountriesViewController

Version License Platform Swift3

Usually during development i have a needed to select a country from list, this simple controller enable you to display a countries list, in a current locale language, and select them. Choose CountriesViewController for your next project, I’ll be happy to give you a little help!

★★ Star our github repository to help us!, or ☕ pay me a coffee ★★

Created by Luca Becchetti

Screenshots

Requirements

  • iOS 9+
  • swift 4.0

Main features

Here’s a highlight of the main features you can find in CountriesViewController:

  • Current Locale Translations Countries name are displayed using current locale
  • Single or multiple. You can use selection as single selection or multiple selection

You also may like

Do you like CountriesViewController? I’m also working on several other opensource libraries.

Take a look here:

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like InAppNotify in your projects. You can install it with the following command:

$ gem install cocoapods

Podfile

To integrate CountriesViewController into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'TargetName' do
  use_frameworks!
  pod 'CountriesViewController'
end

Then, run the following command:

$ pod install

How to use

First of all import library in your project

import CountriesViewController

The basic code to show a simple notification is:

//If you are in a UIViewController

let countriesViewController = CountriesViewController()
countriesViewController.delegate = self
CountriesViewController.Show(countriesViewController: countriesViewController, to: self)

You have to implement the CountriesViewControllerDelegate also:

extension YourViewController : CountriesViewControllerDelegate{
  /// MARK: CountriesViewControllerDelegate

    func countriesViewController(_ countriesViewController: CountriesViewController, didSelectCountries countries: [Country]){

        countries.forEach { (co) in
            print(co.name);
        }
    }

    func countriesViewControllerDidCancel(_ countriesViewController: CountriesViewController) {

        print("user hass been tap cancel")

    }

    func countriesViewController(_ countriesViewController: CountriesViewController, didSelectCountry country: Country) {

        print(country.name+" selected")

    }

    func countriesViewController(_ countriesViewController: CountriesViewController, didUnselectCountry country: Country) {

        print(country.name+" unselected")

    }
}

Customization

you can customize this parameters during inizialization:

/// Create a controller
let countriesViewController = CountriesViewController()

/// Show major country (this countries are displayed in top of tableview, before each others)
countriesViewController.majorCountryLocaleIdentifiers = ["GB", "US", "IT", "DE", "RU", "BR", "IN"]

/// Set initial selected countries
countriesViewController.selectedCountries = Countries.countriesFromCountryCodes(["AL"])

/// Allow or disallow multiple selection
countriesViewController.allowMultipleSelection = true

/// Set delegate
countriesViewController.delegate = self

/// Show
CountriesViewController.Show(countriesViewController: countriesViewController, to: self)

Projects using CountriesViewController

Your App and InAppNotify

I’m interested in making a list of all projects which use this library. Feel free to open an Issue on GitHub with the name and links of your project; we’ll add it to this site.

Credits & License

CountriesViewController is owned and maintained by Luca Becchetti

As open source creation any help is welcome!

The code of this library is licensed under MIT License; you can use it in commercial products without any limitation.

The only requirement is to add a line in your Credits/About section with the text below:

Countries selection by CountriesViewController - http://www.lucabecchetti.com
Created by Becchetti Luca and licensed under MIT License.

About me

I am a professional programmer with a background in software design and development, currently developing my qualitative skills on a startup company named "Frind " as Project Manager and ios senior software engineer.

I’m high skilled in Software Design (10+ years of experience), i have been worked since i was young as webmaster, and i’m a senior Php developer. In the last years i have been worked hard with mobile application programming, Swift for ios world, and Java for Android world.

I’m an expert mobile developer and architect with several years of experience of team managing, design and development on all the major mobile platforms: iOS, Android (3+ years of experience).

I’m also has broad experience on Web design and development both on client and server side and API /Networking design.

All my last works are hosted on AWS Amazon cloud, i’m able to configure a netowrk, with Unix servers. For my last works i configured apache2, ssl, ejabberd in cluster mode, Api servers with load balancer, and more.

I live in Assisi (Perugia), a small town in Italy, for any question, contact me

Latest podspec

{
    "name": "CountriesViewController",
    "platforms": {
        "ios": "9.0"
    },
    "summary": "A view controller that allow user to select a countries, it supports in single or multiple mode",
    "requires_arc": true,
    "version": "0.1.2",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Becchetti Luca": "[email protected]"
    },
    "homepage": "https://github.com/lucabecchetti/CountriesViewController",
    "source": {
        "git": "https://github.com/lucabecchetti/CountriesViewController.git",
        "tag": "0.1.2"
    },
    "frameworks": [
        "UIKit",
        "Foundation",
        "CoreData"
    ],
    "source_files": "CountriesViewController/*.{swift}",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This