Latest 1.0.1
Homepage https://github.com/kkontus/SwiftCheckboxDialogCocoapod
License MIT
Platforms ios 12.0
Authors

Version
License
Platform

Overview

SwiftCheckboxDialog is a simple dialog that contains multiple select checkboxes, written in Swift 4.2 and xCode 10

SwiftCheckboxDialog

Requirements

  • ARC
  • iOS12

Installation with CocoaPods

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

pod "SwiftCheckboxDialog"

Usage

import SwiftCheckboxDialog

class ViewController: UIViewController, CheckboxDialogViewDelegate {
    var checkboxDialogViewController: CheckboxDialogViewController!

    //define typealias-es
    typealias TranslationTuple = (name: String, translated: String)
    typealias TranslationDictionary = [String : String]

    override func viewDidLoad() {
    super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func onButtonPressed(_ sender: UIButton) {
        // this tuple has translated key because it can use localized values in case app needs to be localized
        let tableData :[(name: String, translated: String)] = [("Angola", "Angole"),
                                                                ("Croatia", "Croatia"),
                                                                ("Germany", "Germany"),
                                                                ("Ireland", "Ireland"),
                                                                ("Spain", "Spain"),
                                                                ("United Kingdom", "United Kingdom"),
                                                                ("Venezuela", "Venezuela")]

        self.checkboxDialogViewController = CheckboxDialogViewController()
        self.checkboxDialogViewController.titleDialog = "Countries"
        self.checkboxDialogViewController.tableData = tableData
        self.checkboxDialogViewController.defaultValues = [tableData[3]]
        self.checkboxDialogViewController.componentName = DialogCheckboxViewEnum.countries
        self.checkboxDialogViewController.delegateDialogTableView = self
        self.checkboxDialogViewController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
        self.present(self.checkboxDialogViewController, animated: false, completion: nil)
    }

    func onCheckboxPickerValueChange(_ component: DialogCheckboxViewEnum, values: TranslationDictionary) {
        print(component)
        print(values)
    }
}

Example Project

An example project is included with this repo. To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Kristijan Kontus, [email protected]

License

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

Latest podspec

{
    "name": "SwiftCheckboxDialog",
    "version": "1.0.1",
    "summary": "Simple checkbox dialog written in Swift.",
    "swift_version": "4.2",
    "description": "Simple checkbox dialog written in Swift, it uses AutoLayout to adopt to different screen sizes.",
    "homepage": "https://github.com/kkontus/SwiftCheckboxDialogCocoapod",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "kkontus": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kkontus/SwiftCheckboxDialogCocoapod.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "12.0"
    },
    "source_files": "SwiftCheckboxDialog/Classes/**/*"
}

Pin It on Pinterest

Share This