All Projects → alxrguz → ALRadioButtons

alxrguz / ALRadioButtons

Licence: MIT license
RadioButtons for iOS. Inherited from UIControl, support 2 native styles, fully customizable.

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to ALRadioButtons

Selector-Closure
A light way to convert objc target-action style to closure
Stars: ✭ 14 (-78.46%)
Mutual labels:  uikit, uibutton, uicontrol
ALProgressView
Animated and fully customizable progress view with 2 styles: ring and bar.
Stars: ✭ 72 (+10.77%)
Mutual labels:  apple, uikit, uicomponent
Haptica
Easy Haptic Feedback Generator 📳
Stars: ✭ 587 (+803.08%)
Mutual labels:  apple, uibutton
About Swiftui
Gathering all info published, both by Apple and by others, about new framework SwiftUI.
Stars: ✭ 5,954 (+9060%)
Mutual labels:  apple, uikit
Spalert
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.
Stars: ✭ 1,014 (+1460%)
Mutual labels:  apple, uikit
LPThumbnailView
A thumbnail view for iOS to give context to multiple images/videos using thumbnails and counter.
Stars: ✭ 54 (-16.92%)
Mutual labels:  apple, uikit
WWDC
🌈 𝐖𝐖𝐃𝐂 𝐒𝐞𝐬𝐬𝐢𝐨𝐧 𝐍𝐨𝐭𝐞𝐬 👩🏻‍💻 ✨
Stars: ✭ 31 (-52.31%)
Mutual labels:  apple, uikit
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (+1144.62%)
Mutual labels:  apple, uikit
Swiftybutton
Simple and customizable button in Swift
Stars: ✭ 471 (+624.62%)
Mutual labels:  uikit, uibutton
Drawer View
📤 Custom UI component for iOS, replication of Apple's Apple Music player and Shortcuts’ components view [Swift 5.0, iOS 12].
Stars: ✭ 136 (+109.23%)
Mutual labels:  apple, uikit
Swiftautolayout
Write constraints in a concise, expressive, Swifty way.
Stars: ✭ 83 (+27.69%)
Mutual labels:  apple, uikit
Swiftui Visual Effects
View modifiers that wrap UIVisualEffectView, with environment integration.
Stars: ✭ 137 (+110.77%)
Mutual labels:  apple, uikit
ALButtonMenu
A simple, fully customizable menu solution for iOS.
Stars: ✭ 45 (-30.77%)
Mutual labels:  apple, uikit
Compositional Layouts Kit
📏 A set of advanced compositional layouts for UICollectionView with examples [Swift 5.3, iOS 13].
Stars: ✭ 317 (+387.69%)
Mutual labels:  apple, uikit
Dtgradientbutton
Easy way to set gradient background to your buttons.
Stars: ✭ 76 (+16.92%)
Mutual labels:  uikit, uibutton
Swiftui
A collaborative list of awesome SwiftUI resources. Feel free to contribute!
Stars: ✭ 774 (+1090.77%)
Mutual labels:  apple, uikit
Lgbutton
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
Stars: ✭ 2,216 (+3309.23%)
Mutual labels:  uibutton, uicontrol
RCPickerButton
Simple button for marking some items as selected.
Stars: ✭ 17 (-73.85%)
Mutual labels:  uikit, uibutton
Fruity
Rusty bindings for Apple libraries
Stars: ✭ 72 (+10.77%)
Mutual labels:  apple, uikit
Instagramactivityindicator
Activity Indicator similar to Instagram's.
Stars: ✭ 138 (+112.31%)
Mutual labels:  apple, uikit

ALRadioButtons

Navigation

Requirements

  • iOS 10.0 +
  • Swift 4.2 +

Installation

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To integrate ALRadioButtons click File -> Swift Package -> Add Package Dependency and insert:

https://github.com/alxrguz/ALRadioButtons

CocoaPods

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

pod 'ALRadioButtons'

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate ALRadioButtons into your project manually. Put Source/ALRadioButtons folder in your Xcode project.

Usage

Quick Start

import ALRadioButtons

class MyViewController: UIViewController {

    lazy var radioGroup = ALRadioGroup(items: [
        .init(title: "title1", subtitle: "subtitle1"),
        .init(title: "title2", subtitle: "subtitle2", detail: "Detail"),
        .init(title: "title3"),
    ], style: .grouped)

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.addSubview(radioGroup)
        // ... Setup layout
        
        radioGroup.selectedIndex = 0
      	radioGroup.addTarget(self, action: #selector(radioGroupSelected(_:)), for: .valueChanged)
      
      	// If the checkbox selection can be canceled, then set this property to true 
      	radioGroup.allowDeselection = true
    }
    
    @objc private func radioGroupSelected(_ sender: ALRadioGroup) {
        print(sender.selectedIndex)
    }
}

Customization

Colors

You can customize the buttons, headers and indicators colors depending on their state.

radioGroup.selectedTitleColor = .systemBlue 
radioGroup.unselectedTitleColor = .black 
radioGroup.selectedDetailColor = .systemBlue
radioGroup.unselectedDetailColor = .black
radioGroup.selectedIndicatorColor = .systemBlue 
radioGroup.unselectedIndicatorColor = .systemBlue 
radioGroup.subtitleColor = .lightGray 
radioGroup.buttonBackgroundColor = .white 
radioGroup.separatorColor = .lightGray 

Font

radioGroup.titleFont = .systemFont(ofSize: 16, weight: .medium)
radioGroup.detailFont = .systemFont(ofSize: 16, weight: .regular)
radioGroup.subtitleFont = .systemFont(ofSize: 13, weight: .regular)

Layout

radioGroup.cornerRadius = 14 // Button corner radius, actual for .grouped style
radioGroup.buttonHeight = 50 
radioGroup.subtitleTopOffset = 8 // Subtitle offset from title bottom anchor
radioGroup.separatorTopOffset = 8 // Separator offset from title or subtitle (if added) bottom anchor
radioGroup.indicatorRingWidth = 2 // Outer ring width of indicator
radioGroup.indicatorRingSize = 22 // Indicator outer ring size
radioGroup.indicatorCircleInset = 5 // Indentation of the circle from the outer ring

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].