BadgeIcon is a Swift SDK that helps you mimic native System Settings icons in SwiftUI.
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: @[email protected]
- Twitter: @danielsaidi
- E-mail: [email protected]
BadgeIcon is available under the MIT license. See the LICENSE file for more info.