-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Mor4eza/BadgeSegments
- Loading branch information
Showing
1 changed file
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,19 +10,70 @@ | |
To run the example project, clone the repo, and run `pod install` from the Example directory first. | ||
|
||
## Requirements | ||
- Swift 5 | ||
- iOS =>10 | ||
|
||
## Installation | ||
**Cocoapods** | ||
|
||
BadgeSegments is available through [CocoaPods](https://cocoapods.org). To install | ||
it, simply add the following line to your Podfile: | ||
|
||
```ruby | ||
pod 'BadgeSegments' | ||
``` | ||
**Manual** | ||
|
||
simply copy classes folder to your project directory | ||
|
||
# How to Use | ||
|
||
add a UIView to your view Controller and sub class it from BadgeSegments class | ||
```swift | ||
@IBOutlet weak var badgeSegment: BadgeSegments! | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
|
||
let items = [SegmentItem(title: "first",isSelected: false,badgeNumber: 20), | ||
SegmentItem(title: "second",isSelected: true), | ||
SegmentItem(title: "third",isSelected: false,badgeNumber: 12)] | ||
badgeSegment.appearence = .standard | ||
badgeSegment.delegate = self | ||
badgeSegment.setUpSegments(with: items) | ||
} | ||
``` | ||
**Delegate** | ||
```swift | ||
class ViewController: UIViewController, BadgeSegmentDelegate { | ||
|
||
func didSelectSegment(with index: Int) { | ||
print(index) | ||
} | ||
|
||
|
||
} | ||
``` | ||
**Change Values** | ||
```swift | ||
badgeSegment.setTitle(inIndex: 0, title: "changed") | ||
badgeSegment.setSelected(inIndex: 2) | ||
badgeSegment.setBadgeNumber(inIndex: 1, badgeNum: 12) | ||
|
||
``` | ||
|
||
# TO Do | ||
- [ ] add animation | ||
- [ ] more default appearences | ||
- [ ] support images | ||
- [ ] customize badge view | ||
- [ ] add UITest and UnitTest | ||
|
||
|
||
# Made with Love in 🇮🇷 | ||
Morteza Gharedaghi: [email protected] | ||
|
||
## Author | ||
|
||
[email protected], [email protected] | ||
|
||
## License | ||
|
||
|