Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Mor4eza/BadgeSegments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mor4eza committed Sep 22, 2019
2 parents 2227b6c + 1994922 commit ebd7fcf
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ebd7fcf

Please sign in to comment.