You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-13Lines changed: 22 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,23 @@
1
1
# LTHRadioButton
2
-
![Build status][image-1]
3
2
4
3
Slightly inspired by Google's material radio button.
5
4
6
5
The clip below has 3 sections: full speed, 25% and 10%, but after converting it to GIF, it actually made it longer, so the 10% part takes a really long time. [Here's][1] an mp4 link; try with Chrome if Safari doesn't work - for me it doesn't.
7
6
8
-
![][image-2]
7
+
![][image-1]
9
8
10
9
## How to install
11
10
11
+
### Swift Package Manager
12
+
13
+
**NOTE**: _These instructions are intended for usage on Xcode 11 and higher. Xcode 11 is the first version of Xcode that integrates Swift Package Manager and makes it way easier to use than it was at the command line. If you are using older versions of Xcode, we recommend using CocoaPods._
14
+
15
+
1. Go to File > Swift Packages > Add Package Dependency...
16
+
2. Paste the URL to the `LTHRadioButton` repo on GitHub (https://github.com/rolandleth/LTHRadioButton.git) into the search bar, then hit the Next button:
17
+
3. Select what version you want to use, then hit next (Xcode will automatically suggest the current version Up to Next Major).
18
+
4. Select the `LTHRadioButton` library and then hit finish.
19
+
5. You're done!
20
+
12
21
#### CocoaPods
13
22
14
23
[CocoaPods][2] is a dependency manager for Cocoa projects. You can install it with the following terminal command:
@@ -43,9 +52,9 @@ Drag `LTHRadioButton.swift` from the `source` folder into your Xcode project.
43
52
44
53
The initializer takes up to 3 params: a `diameter`, a `selectedColor`, and a `deselectedColor`. All of them are optional:
45
54
46
-
*`diameter` defaults to `18`
47
-
*`selectedColor` defaults to a light blue
48
-
*`deselectedColor` defaults to `UIColor.lightGray`
55
+
-`diameter` defaults to `18`
56
+
-`selectedColor` defaults to a light blue
57
+
-`deselectedColor` defaults to `UIColor.lightGray`
49
58
50
59
It doesn't use Auto Layout internally, but after initialization it will have a proper size, so you can simply create constraints based on its `frame.width` and `frame.height`.
51
60
@@ -56,8 +65,9 @@ It doesn't use Auto Layout internally, but after initialization it will have a p
56
65
`isSelected` - Indicates whether the radio button is selected.
57
66
58
67
`useTapGestureRecognizer` - Indicates whether a tap gesture recognizer should be added to the control when setting callbacks. This defaults to `true` just so that `onSelect` and `onDeselect` can add the gesture recognizer automatically, but the recognizer is **not** added by default.
59
-
- Settings this to `true` will also add the required `UITapGestureRecognizer` if needed.
60
-
- Settings this to `false` will also remove the `UITapGestureRecognizer` if it was previously added.
68
+
69
+
- Settings this to `true` will also add the required `UITapGestureRecognizer` if needed.
70
+
- Settings this to `false` will also remove the `UITapGestureRecognizer` if it was previously added.
0 commit comments