This package only provides a Swift wrapper around the official Bootstrap Icons.
The package depends on SwiftHtml, created and maintained by Tibor Bödecs (SwiftHtml).
I am not the creator of the icons themselves.
- Bootstrap Icons were created and are maintained by the Bootstrap team, led by @mdo.
- The full icon set, documentation, and usage instructions can be found at https://icons.getbootstrap.com/.
- This wrapper simply makes them easier to use in Swift projects via SwiftHtml.
- Type‑safe
SvgIconenum (no string literals) - Handles Swift reserved keywords and leading digits
- Accessibility via
<title>andaria-labelledby(oraria-hiddenwhen no title) - Applies official Bootstrap classes (
bi bi-<icon>) - Flexible sizing (
width/heightin px, or100%when set to 0)
Add the package dependency to your Package.swift:
dependencies: [
.package(url: "https://github.com/swiftlang/swift-markdown.git", from: "0.7.2")
]// targets:
.product(name: "BootstrapIcons", package: "swift-html-bootstrap-icons"),
let bell = Svg.icon(.bell)
This renders:
<svg class="bi bi-bell" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
<path d="..." />
</svg>
let bell = Svg.icon(.bell, title: "Notifications")
This renders:
<svg class="bi bi-bell" width="16" height="16" viewBox="0 0 16 16" aria-labelledby="title-bell">
<title id="title-bell">Notifications</title>
<path d="..." />
</svg>
// 24x24 pixels
let largeBell = Svg.icon(.bell, width: 24, height: 24)
// Full width/height of container
let responsiveBell = Svg.icon(.bell, width: 0, height: 0)