BSCountryViewController 0.1.5

BSCountryViewController 0.1.5

Maintained by Adobels.



  • By
  • Blazej SLEBODA

BSCountryViewController

CI Status CI Status Version Platform

Requirements

Minimum: Swift 5.1.0, Xcode 11.0.0, iOS 9.0.0

Installation

CocoaPods

BSCountryViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BSCountryViewController'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Alamofire does support its use on supported platforms.

Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/Adobels/BSCountryViewController.git", .upToNextMajor(from: "1.0.0"))
]

Usage

    import UIKit
    import BSCountryViewController

    class ViewController: UIViewController {
        
        @IBAction func didTapPresentCountriesPickerButton() {
            let vc = BSCountryViewController()
            vc.delegate = self
            present(vc, animated: true, completion: nil)
        }
    }

    extension ViewController: BSCountryViewControllerDelegate {
        func didSelectRegions(_ regions: [String]) {
            debugPrint("--- didSelectRegions ---")
            debugPrint(regions)
        }
        
        func didTapDoneButton(with regions: [String]?) {
            debugPrint("--- didTapDoneButton ---")
            debugPrint(regions ?? "regions array is nil")
            dismiss(animated: true, completion: nil)
        }
    }

Screenshot

BSCountryViewController screenshot animated gif