Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepistrol committed Jul 5, 2023
2 parents d6fe0ff + 5f3675c commit 49d35a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 11 additions & 3 deletions Demo App/Demo App/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ struct ContentView: View {
VStack {
Label("Hello, World!", systemImage: Symbols.globe())
Spacer()
LazyVGrid(columns: .init(repeating: GridItem(.fixed(50)), count: 5), content: {
ForEach(Symbols.allCases, id: \.self.rawValue) { symbol in
LazyVGrid(columns: columns) {
ForEach(Symbols.allCases) { symbol in
symbol.image
.imageScale(.medium)
.font(.largeTitle)
}
})
}
}
.padding()
}

private var columns: [GridItem] {
.init(repeating: GridItem(.fixed(50)), count: 5)
}
}

extension Symbols: Identifiable {
var id: String { self.rawValue }
}

#Preview {
Expand Down
8 changes: 5 additions & 3 deletions Sources/SFSymbolsMacroImpl/SFSymbolsMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ public struct SFSymbolMacro: MemberMacro {
}

private static func assertUINSImage(for id: (SymbolPair)) throws {
if let _ = NSImage(systemSymbolName: id.id, accessibilityDescription: nil) {
return
}
#if canImport(UIKit)
if let _ = UIImage(systemName: id.id) { return }
#else
if let _ = NSImage(systemSymbolName: id.id, accessibilityDescription: nil) { return }
#endif
throw DiagnosticsError(diagnostics: [
.init(node: id.node, message: SFSymbolDiagnostic.noValidSFSymbol(symbol: id.0))
])
Expand Down

0 comments on commit 49d35a5

Please sign in to comment.