standard
Underlined
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Swift => 5
- iOS => 10
Cocoapods
BadgeSegments is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BadgeSegments'
Manual
simply copy classes folder to your project directory
add a UIView to your view Controller and sub class it from BadgeSegments class
@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
class ViewController: UIViewController, BadgeSegmentDelegate {
func didSelectSegment(with index: Int) {
print(index)
}
}
Change Values
badgeSegment.setTitle(inIndex: 0, title: "changed")
badgeSegment.setSelected(inIndex: 2)
badgeSegment.setBadgeNumber(inIndex: 1, badgeNum: 12)
- add animation
- more default appearences
- support images
- customize badge view
- add UITest and UnitTest
Morteza Gharedaghi: [email protected]
feel free to create issue or open a pull request
send your application name to me,if you used this library
- Wink App
BadgeSegments is available under the MIT license. See the LICENSE file for more info.