Skip to content

danielsaidi/BadgeIcon

Repository files navigation

BadgeIcon Logo

Version Swift 5.9 Swift UI MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About BadgeIcon

BadgeIcon is a Swift SDK that helps you mimic native System Settings icons in SwiftUI.

BadgeIcon comes with a bunch of predefined icons:

BadgeIcon Preview

You can also create your own icons, with rich customization options.

Installation

BadgeIcon can be installed with the Swift Package Manager:

https://github.com/danielsaidi/BadgeIcon.git

Getting started

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.

Documentation

The online documentation has more information, articles, code examples, etc.

Support my work

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.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

BadgeIcon is available under the MIT license. See the LICENSE file for more info.