Skip to content

Commit

Permalink
improve image check
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaker6 committed Jul 5, 2024
1 parent 5132a32 commit fcbf022
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/CareKitEssentials/Extensions/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public extension Image {
}
return Image(name)
}
#elseif canImport(AppKit)
guard NSImage(systemSymbolName: name, accessibilityDescription: nil) != nil else {
guard NSImage(named: name) != nil else {
guard let otherUrlUIImage = NSImage(contentsOfFile: name) else {
return nil
}
return Image(nsImage: otherUrlUIImage)
}
return Image(name)
}
#endif
return Image(systemName: name)
}
Expand Down

0 comments on commit fcbf022

Please sign in to comment.