8000 GitHub - iamshezad/SHSelections: A sample project demonstrates the usage of SHSelection Class to implement checkbox and radio buttons easily.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A sample project demonstrates the usage of SHSelection Class to implement checkbox and radio buttons easily.

License

Notifications You must be signed in to change notification settings

iamshezad/SHSelections

Repository files navigation

SHSelections

A sample project demonstrates the usage of SHSelection Class to implement checkbox and radio buttons easily.

Swift 4.0 License Platform

Installation

Just drag and drop the SHSelections folder to your project.

Cocoapods - updating soon

Usage

  1. Just drag and drop an Table View in storyboard and set Table View class to SHSelections and set an outlet.

  1. How to configure:

Example Code

    @IBOutlet weak var checkboxSelection: SHSelections!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        checkboxSelection.selectionType = .checkbox // by default .checkbox 
        checkboxSelection.items = ["CheckBox item 1","CheckBox item 2","CheckBox item 3","CheckBox item 4"]
        checkboxSelection.checkedIcon = UIImage(named: "some image name")!
        checkboxSelection.unCheckedIcon = UIImage(named: "some image name")!
    }
  • for checkbox :
selectionType = .checkbox 
  • for radio button :
selectionType = .radio 
  • for items to display :
items = ["CheckBox item 1"] \\pass an array of string
  • for icons(for custom icons) :
    \\by default it has icons, you can pass custom icons
    \\Check box  
     checkedIcon = UIImage(named: "some image name")!
     unCheckedIcon = UIImage(named: "some image name")!
     \\Radio button
     radioEmptyIcon = UIImage(named: "some image name")!
     radioSelectedIcon = UIImage(named: "some image name")!
                 
  1. Setting delegate :

Example Code

    class ViewController: UIViewController,SHSelectionProtocol {

    @IBOutlet weak var checkboxSelection: SHSelections!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        checkboxSelection.selectionDelegate = self
        -
        -
        -
    }


    //Delegate methods
    //Radio Button selected Index
    func getRadioIndex(index: Int) {
        print(index)
    }
    //Radio Button selected item
    func getRadioItem(item: String) {
        print(item)
    }
    
   
68D7
 //Checkbox all selected Indexes
    func getCheckboxIndex(indexes: [Int]) {
        print(indexes)
    }
    //Checkbox all selected Indexes
    func getCheckboxItems(items: [String]) {
        print(items)
    }

}
  • to get checkbox selected index array :
func getCheckboxIndex(indexes: [Int]){ } 
  • to get checkbox selected items array :
func getCheckboxItems(items: [String]){ } 
  • to get radio button selected index :
func getRadioIndex(index: Int){ } 
  • to get radio button selected item :
func getRadioItem(item: String) 

Requirements

  • iOS 10.0+

Example

Download the Sample project.

Contact

Mail me @: shezadahamed95@gmail.com

About

A sample project demonstrates the usage of SHSelection Class to implement checkbox and radio buttons easily.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0