https://github.com/timoliver/tobadgeview
A badge view that can be used to accessorize other UI elements in iOS.
https://github.com/timoliver/tobadgeview
Last synced: about 1 year ago
JSON representation
A badge view that can be used to accessorize other UI elements in iOS.
- Host: GitHub
- URL: https://github.com/timoliver/tobadgeview
- Owner: TimOliver
- License: mit
- Created: 2018-11-07T16:02:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-07T01:49:07.000Z (almost 5 years ago)
- Last Synced: 2025-04-11T20:12:36.422Z (about 1 year ago)
- Language: Objective-C
- Size: 188 KB
- Stars: 17
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# TOBadgeView
[](https://cocoapods.org/pods/TOBadgeView)
[](http://cocoadocs.org/docsets/TOBadgeView)
[](https://raw.githubusercontent.com/TimOliver/TOBadgeView/master/LICENSE)
[](http://cocoadocs.org/docsets/TOBadgeView)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M4RKULAVKV7K8)
`TOBadgeView` is a very basic `UIView` subclass to provide a GPU-efficient recreation of the class iOS badge icon.
It is wholly dynamic, where all sizing, fonts and colors can be changed, and it can intelligently resize itself to fit a particular text value.
## Features
* Recreates the standard iOS badge icon and style.
* Uses Core Animation and Metal to provide VERY efficient layer compositing.
## System Requirements
iOS 9.0 and above.
## Installation
**As a CocoaPods Dependency**
Add the following to your Podfile:
```
pod 'TOBadgeView'
```
**Manual Installation**
Copy the folder `TOBadgeView` to your Xcode project.
`TOBadgeView` is an Objective-C project, but it has been written to work properly in Swift as well. If you are using it in a Swift project, don't forget to include it in your Objective-C bridging header.
## Examples
`TOBadgeView` is very bare-bones and behaves in what should be a very intuitive manner.
### Hello World Example
```swift
let badgeView = BadgeView() // Create the badge view
badgeView.text = "1"
badgeView.sizeToFit() // Change the badge view size to fit
```
## Credits
`TOBadgeView` was originally created by [Tim Oliver](http://twitter.com/TimOliverAU) as a component for [iComics](http://icomics.co), a comic reader app for iOS.
iOS Device mockups used in the screenshot created by [Pixeden](http://www.pixeden.com).
## License
TOBadgeView is licensed under the MIT License, please see the [LICENSE](LICENSE) file. 