问题
Where can I find all the system images that are available in the initializer Image(systemName:)
?
I've only been using "chevron"
and "star.fill"
so far, as discovered in Apple's SwiftUI tutorial series. However, I haven't been able to find a full list of icons in any official documentation.
回答1:
These icons are called SF Symbols. There are over 1,500 symbols that can be used in apps running in iOS 13 and later.
To browse the full set of symbols, download the SF Symbols app. For more info about SF Symbols check here.
Usage
UIKit:
let heartImage = UIImage(systemName: "heart.fill")
SwiftUI:
let heartImage = Image(systemName: "heart.fill")
回答2:
You can use SF Symbol Images in SwiftUI
Image(systemName: "person")
Download Link : https://developer.apple.com/design/resources/
回答3:
Assuming you have Xcode installed, you can also preview all the images without needing to download a separate app.
The trick is you need to view them in a Storyboard, not a SwiftUI Canvas.
Add a UIImageView to your storyboard, then press the dropdown arrow near Image. You'll see the entire list of images provided by Apple:
来源:https://stackoverflow.com/questions/56514998/find-all-available-images-for-imagesystemname-in-swiftui