Skip to content

ObjectiveC-Challenge/HJVisualComponents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HJVisualComponents

HJVisualComponents is a visual component framework. Components:

  • Radio button

Table of contents


Radio button

Screenshots


Instalation

Swift Package Manager

Add dependency:

.package(url: "https://github.com/ObjectiveC-Challenge/HJVisualComponents.git", from: "1.0.9")

or

  1. In your project click: File -> Swift Packages -> Add Package Dependency...
  2. Then, paste https://github.com/ObjectiveC-Challenge/HJVisualComponents
  3. Then next -> next

Get started

  1. Import HJVisualComponents
import HJVisualComponents
  1. Create a Radio Button
let radioButtonDefault = RadioButton() // Default init
let radioButtonCustom = RadioButton(multiplier: 0.5, selectedColor: .black, unselectedColor: .gray, fontColor: .black, orientation: .horizontal)) // Custom init
  1. Setup options
radioButtonDefault.setOptions(["A", "B", "C"])
  1. Setup radio buttons dimensions
NSLayoutConstraint.activate([
    radioButton.widthAnchor.constraint(equalToConstant: 300),
    radioButton.heightAnchor.constraint(equalToConstant: 100)
])

You can see better an example of use with Swift here: https://github.com/ObjectiveC-Challenge/SampleSwift


Documentation

Radio Button

Functions

Custom init

Custom init allows you to set the following parameters:

  • multiplier: Button size relative to parent view
  • selectedColor: Button color when selected
  • unselectedColor: Button color when not selected
  • fontColor: Color of the label below the button
  • orientation: that represents the button's orientation. Can ben horizontal or vertical.
RadioButton(multiplier: 0.5, selectedColor: .blue, unselectedColor: .red, fontColor: .gray, orientation: .horizontal))

Default init

Default init have default values to:

  • multiplier: 0.5
  • selectedColor: UIColor.black
  • unselectedColor: UIColor.gray
  • fontColor: UIColor.black
  • orientation: .horizontal
RadioButton()

setOptions

Use this function to configure the quantity and values of radio button's options. The options must be a type that can be converted to NSString.

radioButton.setOptions(["A", "B", "C"])

getSelectedValue

Use this function to return the selected option. If there aren't select options, this function returns nil.

radioButton.getSelectedValue()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published