项目作者: chibombo

项目描述 :
RadioButton for iOS
高级语言: Swift
项目地址: git://github.com/chibombo/RadioButton.git
创建时间: 2020-03-30T02:54:22Z
项目社区:https://github.com/chibombo/RadioButton

开源协议:MIT License

下载


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() {

    1. super.viewDidLoad()
    2. let arrRadioButtons: [RadioButton] = [radioButtonOne, radioButtonTwo]
    3. radioController = RadioButtonController(arrRadioButton: arrRadioButtons)

    }
    }

extension ViewController: RadioButtonControllerDelegate {

  1. func radioButton(_ radioButtonController: RadioButtonController, radioButton changed: RadioButton) {
  2. }

}
```