Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.46 KB

README.md

File metadata and controls

57 lines (41 loc) · 1.46 KB

RadioButton

An easy way to implement RadioButtons in Swift

Features

  • Create RadioButtons in iOS
  • Customize the RadioButtons:
    • Colors
    • Width
  • Optional Controller

Requirements

  • iOS 9+
  • Swift 4+

Installation

pod 'GARRadioButton', '~> 1.0'

Example

  1. Create an UIButton
  2. Go to Identity Inspector and set RadioButton as Class and GARRadioButton as Module

How to set RadioButton

  1. Go to Attributes Inspector and del delete the Default Title How to set RadioButton

  2. Set IBOutlets in the ViewController

  3. ViewController

import UIKit
import GARRadioButton
class ViewController: UIViewController {

    @IBOutlet weak var radioButtonOne: RadioButton!
    @IBOutlet weak var radioButtonTwo: RadioButton!
    
    var radioController: RadioButtonController!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let arrRadioButtons: [RadioButton] = [radioButtonOne, radioButtonTwo]
        radioController = RadioButtonController(arrRadioButton: arrRadioButtons)
    }
}

extension ViewController: RadioButtonControllerDelegate {
    
    func radioButton(_ radioButtonController: RadioButtonController, radioButton changed: RadioButton) {
        
    }
}