AdmiralSwiftUI BadgeView - admiral-team/admiralui-ios GitHub Wiki
Overview
BadgeView
- The Badge component shows a quantitative value, usually complements other components, for example, to show the number of alerts in the Bottom navigation or Toolbar section
BadgeStyle
- Public enum for style BadgeView
Code
BadgeView(
badgeStyle: .default,
value: 1,
content: {
Image("Your image")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 50.0, height: 50.0, alignment: .center)
})
You can create a BadgeView
by specifying the following parameters in the initializer
- value: Int? - Integer value of the badge.
- text: String? - Text value of the badge.
- badgeStyle: BadgeStyle - Badge style to configure the badge with library styles or custom style.
- content: () -> (Content) - Сlosure returning a new view containing content.
- borderColor: Color? - Border color. Default from color style.
- offset: CGPoint? - Badge offset. Default is zero.
BadgeStyle can be one of the following values:
- natural - The natural state of the badge
- default - The default state of the badge
- additional - The additional state of the badge
- success - The success state of the badge
- error - The error state of the badge is useful to show the number of errors
- attention - The attention state of the badge is useful to show the number of attentions
Live Example
To run live demo with BadgeView
open Xcode and run project with Example target. Then in the Chat -> Badges
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 apull request
in our project. You can read more about this in the Github documentation.