diff --git a/Backpack-SwiftUI/Icons/Classes/Generated/BPKIcons.swift b/Backpack-SwiftUI/Icons/Classes/Generated/BPKIcons.swift index 9521a32a3..8e35b62b4 100644 --- a/Backpack-SwiftUI/Icons/Classes/Generated/BPKIcons.swift +++ b/Backpack-SwiftUI/Icons/Classes/Generated/BPKIcons.swift @@ -297,13 +297,12 @@ public extension BPKIcon { } public extension BPKIcon { - // swiftlint:disable function_body_length cyclomatic_complexity - static func named(_ iconName: String, bundle: Bundle? = nil) -> BPKIcon? { - - if let bundle { - return BPKIcon(name: iconName, bundle: bundle) - } + static func named(_ iconName: String, bundle: Bundle) -> BPKIcon { + BPKIcon(name: iconName, bundle: bundle) + } + // swiftlint:disable function_body_length cyclomatic_complexity + static func named(_ iconName: String) -> BPKIcon? { switch iconName { case "accessibility": return .accessibility case "account--add": return .accountAdd diff --git a/templates/swiftui/BPKIcons.njk b/templates/swiftui/BPKIcons.njk index 1a40e8412..024938da2 100644 --- a/templates/swiftui/BPKIcons.njk +++ b/templates/swiftui/BPKIcons.njk @@ -24,13 +24,12 @@ public extension BPKIcon { } public extension BPKIcon { - // swiftlint:disable function_body_length cyclomatic_complexity - static func named(_ iconName: String, bundle: Bundle? = nil) -> BPKIcon? { - - if let bundle { - return BPKIcon(name: iconName, bundle: bundle) - } + static func named(_ iconName: String, bundle: Bundle) -> BPKIcon { + BPKIcon(name: iconName, bundle: bundle) + } + // swiftlint:disable function_body_length cyclomatic_complexity + static func named(_ iconName: String) -> BPKIcon? { switch iconName { {% for icon in icons -%} case "{{icon.file}}": return .{{icon.name}}