Skip to content

Commit 56ef3f3

Browse files
authored
Merge pull request #11 from rolandleth/spm
Package.swift
2 parents f62a660 + 1ab783d commit 56ef3f3

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

Package.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// swift-tools-version:5.5
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "LTHRadioButton",
7+
products: [
8+
.library(
9+
name: "LTHRadioButton",
10+
targets: ["LTHRadioButton"]
11+
),
12+
],
13+
targets: [
14+
.target(
15+
name: "LTHRadioButton",
16+
dependencies: [],
17+
path: "source"
18+
),
19+
]
20+
)

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# LTHRadioButton
2-
![Build status][image-1]
32

43
Slightly inspired by Google's material radio button.
54

65
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.
76

8-
![][image-2]
7+
![][image-1]
98

109
## How to install
1110

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+
1221
#### CocoaPods
1322

1423
[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.
4352

4453
The initializer takes up to 3 params: a `diameter`, a `selectedColor`, and a `deselectedColor`. All of them are optional:
4554

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`
4958

5059
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`.
5160

@@ -56,8 +65,9 @@ It doesn't use Auto Layout internally, but after initialization it will have a p
5665
`isSelected` - Indicates whether the radio button is selected.
5766

5867
`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.
6171

6272
#### Methods
6373

@@ -109,11 +119,10 @@ radioButton.deselect(animated: false) // I'm deselected.
109119
If you're using this control, I'd love hearing from you!
110120

111121
## License
112-
Licensed under MIT. If you'd like (or need) a license without attribution, don't hesitate to [contact me][3].
113122

114-
[1]: https://rolandleth.com/images/radio-button/video.mp4
115-
[2]: https://cocoapods.org
116-
[3]: mailto:roland@leth.ro
123+
Licensed under MIT. If you'd like (or need) a license without attribution, don't hesitate to [contact me][3].
117124

118-
[image-1]: https://build.appcenter.ms/v0.1/apps/5db0760a-3f93-4409-9101-7a5a037bfb14/branches/master/badge
119-
[image-2]: https://rolandleth.com/images/radio-button/gif.gif
125+
[1]: https://rolandleth.com/images/radio-button/video.mp4
126+
[2]: https://cocoapods.org
127+
[3]: mailto:roland@hey.com
128+
[image-1]: https://rolandleth.com/images/radio-button/gif.gif

0 commit comments

Comments
 (0)