Badge - admiral-team/admiralui-ios GitHub Wiki

Class

An object that displays a text in circle.


Declaration

open class Badge: UIView, AnyAppThemable, AccessibilitySupport 

Overview

Badge is a component that usually complements other components and shows quantitative scores. For example, a tabs component can show the number of items in a bookmark. Or show the number of notifications in the notification panel.

Configure a Badge

For configuration badge view need set text.

let badge = Badge()
badge.text = "1"

Also you can set style for background presentation. For example, if you want show badge with error, we recommend use style error.

badge.style = .error

If you don't want show text of badge view. You can set text nil, then badge will present by point.

badge.text = nil

Number badge

For useful we create class NumberBadge there you can set parameter text into badge by integer. Also you can set max number for badge. For example, you set max value 10, if value parameter of badge view will 11, then badge view show text "10+".

let view = NumberBadge()
view.value = 1
view.maxValue = 10

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.