Generate a "badge" (circular label) for any view and place it in the center or any corner of a given view
Badge Generator uses a lightweight, easy to understand approach to make a circular UILabel with the given text
In your Xcode project, simply go to File -> Swift Packages -> Add Package Dependency. Then use this repo's URL: https://github.com/froggomad/BadgeGenerator
let myView = UIView()
let badge = myView.setBadge(in: .northWest, with: "1")
n
badge.incrementIntValue(by: 1)
text
value can't be converted to Int
let value = badge.incrementIntValue(by: 1)
switch value {
case let .success(intValue):
print(intValue)
case let .failure(error):
print(error)
}
badge.set("foo")
badge.remove()
These badges are placed on a PreviewProvider
, but you can place them on any UIView or in SwiftUI using UIViewRepresentable
If you notice a bug, or think of a feature you'd like to add, please read our Contributor's Guide
link |
Stars: 11 |
Last commit: 2 years ago |
Added support for SwiftUI Previews via ViewRepresentable
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics