BadgeIcon is a SwiftUI SDK that helps you mimic native System Settings icons.
BadgeIcon comes with a bunch of predefined icons:
You can also create your own icons, with rich customization options.
BadgeIcon can be installed with the Swift Package Manager:
https://github.com/danielsaidi/BadgeIcon.git
BadgeIcon has 30+ predefined icon types, for instance .alert
, .bug
, .heart
, etc.
You can use these badges as regular images, which will scale to fill the available space:
struct ContentView: View {
var body: some View {
BadgeIcon.calendar
}
}
You can also create your own badge icons, with custom icon and badge styling:
extension BadgeIcon {
public static let prominentError = Self(
icon: MyCustomErrorIcon(),
style: .init(
badgeColor: .red
)
)
}
You can use both Image
values or custom views as the icon.
The online documentation has more information, articles, code examples, etc.
You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.
Your support makes it possible for me to put more work into these projects and make them the best they can be.
Feel free to reach out if you have questions or if you want to contribute in any way:
- Website: danielsaidi.com
- Mastodon: @danielsaidi@mastodon.social
- Twitter: @danielsaidi
- E-mail: daniel.saidi@gmail.com
BadgeIcon is available under the MIT license. See the LICENSE file for more info.