Convenience initializers for SwiftUI views that Apple should have shipped.
Add SwiftUIHelpers to your project via Swift Package Manager:
dependencies:[.package(url:"https://github.com/samhenrigold/SwiftUIHelpers.git", from:"1.0.0")]Label("Wait gimme a sec"){ProgressView()}Uses private _internalSystemName: for SF Symbols not publicly exposed:
Section{Label("1984", internalSystemName:"macintosh.classic")Label("2026", systemImage:"macbook.sizes")Label("Become a tester", internalSystemName:"apple.testflight")Label("Oh hello", internalSystemName:"emoji.face.winking.with.stuck.out.tongue")}Create labels directly from platform-native image instances:
// iOS, tvOS, watchOS, visionOS
leticon=UIImage(named:"custom-icon")!
Label("Custom Icon", uiImage: icon)
// macOS
leticon=NSImage(named:"custom-icon")!
Label("Custom Icon", nsImage: icon)Section{LabeledContent("Wi-Fi", systemImage:"wifi"){Text("Home Network")}LabeledContent("Bluetooth", internalSystemName:"bluetooth"){Text("On")}}Available on iOS 18 and aligned releases (2024):
TabView{Tab("Home", value:.home){HomeView()}Tab("Settings", value:.settings){SettingsView()}Tab("About", value:.about){AboutView()}}Check whether system symbols exist before using them, preventing runtime issues when symbols aren't available:
// Check public system symbols
ifImage.systemSymbolExists("star.leadinghalf.filled"){Image(systemName:"star.leadinghalf.filled")}else{Image(systemName:"star.fill")}
// Check private system symbols
ifImage.privateSymbolExists("macintosh.classic"){Image(_internalSystemName:"macintosh.classic")}else{Image(systemName:"desktopcomputer")}Note
Private symbols are not guaranteed to be available across OS versions and may change without notice. Use privateSymbolExists(_:) to safely check availability before using them.
Original code by Julien Sagot.
Apply different modifiers based on availability checks, compiler directives, or build configuration:
Button("Sign In"){}.staticTransform{ view inif #available(iOS 26.0,*){
view.buttonStyle(.glass)}else{
view.buttonStyle(.bordered)}}Warning
staticTransform is designed exclusively for compile-time conditions. Do not use it as a general-purpose conditional modifier with runtime state (@State, @Binding, computed properties, etc.). Doing so will break view identity and cause performance issues. For runtime conditionals, prefer ternary operators (e.g., .foregroundStyle(isActive ? .blue : .gray)).


