Find all available images for Image(systemName:) in SwiftUI

送分小仙女□ 提交于 2020-04-07 12:43:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!