Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButton/CheckButton and RadioButtonGroup/CheckButtonGroup #1004

Merged
merged 9 commits into from
Mar 20, 2018
Merged

RadioButton/CheckButton and RadioButtonGroup/CheckButtonGroup #1004

merged 9 commits into from
Mar 20, 2018

Conversation

OrkhanAlikhanov
Copy link
Contributor

@OrkhanAlikhanov OrkhanAlikhanov commented Dec 24, 2017

RadioButton

open func setIconColor(_ color: UIColor, for state: UIControlState)
open func iconColor(for state:  UIControlState) -> UIColor
open override var isEnabled: Bool { get set }
open override var isSelected: Bool { get set }
open var isAnimating: Bool { get }
open func setSelected(_ isSelected: Bool, animated: Bool)

CheckButton

// ... Same as RadioButton
open var checkmarkColor: UIColor { get set }

RadioButtonGroup

public convenience init(titles: [String])
public convenience init(buttons: [RadioButton])

open var buttons: [RadioButton] { get set }
open var selectedButton: RadioButton? { get }
open var selectedIndex: Int { get }

CheckButtonGroup

public convenience init(titles: [String])
public convenience init(buttons: [CheckButton])

open var buttons: [CheckButton] { get set }
open var selecetedButtons: [CheckButton] { get }
open var selectedIndices: [Int] { get }

A quick demo with this setup code
radio demo

@OrkhanAlikhanov
Copy link
Contributor Author

Let me add docs as well

Before this commit, cgPath and lineWidth of the check mark layer were only updated on the change of selected state.
Fixed to react to size changes made to the parent layer by iOS framework
Fixes bug when CheckButton is changed to have selected state when it has no size (CGSize.zero)
@adamdahan
Copy link
Contributor

@OrkhanAlikhanov What a great job you have done with RadioButton, CheckboxButton, Groups and their internals 👏

Great use of:

  • CALayers
  • High order functions
  • Motion
    & Grid.

All of my comments in regard to the implementation would have only been about:

  • Private struct for numbers
  • Access control
  • Function signatures

Let's have a conversation over Gitter and well get this into the next release.

Thank you for your hard work.

@OrkhanAlikhanov
Copy link
Contributor Author

@adamdahan Thank you for the review, I'll refactor the code according to your suggestions at this weekend inshaAllah

@daniel-jonathan daniel-jonathan changed the base branch from development to m3 January 21, 2018 16:29
@Recouse
Copy link

Recouse commented Mar 20, 2018

Any news?

@OrkhanAlikhanov
Copy link
Contributor Author

@Recouse If you want the component, drag and drop the files into your project and import Material framework for every file:

import Material

If a file does not compile add @testable import Material because I've used some internal things in some files.

@Recouse
Copy link

Recouse commented Mar 20, 2018

@OrkhanAlikhanov Thanks.
But it will be better to see this in Material library.

@daniel-jonathan daniel-jonathan changed the base branch from m3 to development March 20, 2018 18:48
@daniel-jonathan daniel-jonathan merged commit 52dd955 into CosmicMind:development Mar 20, 2018
@mahdimoqadasi
Copy link

mahdimoqadasi commented Jul 20, 2020

How can I use right to left? (I want to label be on left side)

@mahdimoqadasi
Copy link

I found it. for anyone has this issue:
radioItem.semanticContentAttribute = .forceRightToLeft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants