Find all available images for as `systemName` in SFSymbols

后端 未结 6 1075
情歌与酒
情歌与酒 2021-01-30 19:38

Where can I find all the system images that are available in the SFSymbols? for example in the SwiftUI Image initializer Image(systemName:)?

I\'

相关标签:
6条回答
  • 2021-01-30 19:51

    Take a look at this Swift Package SFSafeSymbols

    You can access all the SF Symbols from an enum

    static func getRandomSFSymbol() -> SFSymbol {
        return SFSymbol.allCases.randomElement() ?? SFSymbol.xCircle
    }
    
    0 讨论(0)
  • 2021-01-30 20:03

    You can use SF Symbol Images in SwiftUI

    Image(systemName: "person")
    

    Download Link : https://developer.apple.com/design/resources/

    0 讨论(0)
  • 2021-01-30 20:05

    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:

    Copy the name of an image, and then use it just like other answers mention above:

    Image(systemName: "square.and.arrow.up")
    
    0 讨论(0)
  • 2021-01-30 20:09

    You can also found all names here:

    https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/

    0 讨论(0)
  • 2021-01-30 20:12

    The App by 

    Apple has a dedicated App for this called SF Symbol. You should download the latest version from here to browse the full set of symbols.


    Important Note

    You should always stay with the app to have new symbols available for preview, export and enjoy.


    Backward compatibility.

    If you need to use new symbols like the new multi-color ones that introduced in SF Symbols 2.0 for iOS 14 and above, you can export them using the app itself and import them as assets in the project. Step 1 and 2 of this answer shows how you can export symbols to use it for older iOS versions

    0 讨论(0)
  • 2021-01-30 20:15

    These icons are called SF Symbols. There are over 2,400 symbols you can use in iOS 13 and later, macOS 11 and later, watchOS 6 and later, and tvOS 13 and later. You can use a symbol everywhere you can use an image.

    To browse the full set of symbols, download the SF Symbols app. For more info about SF Symbols check here.


    SF Symbols 2 introduces over 750 new symbols and includes:

    • Over 150 preconfigured, multicolor symbols that automatically adapt to vibrancy, accessibility settings, and appearance modes
    • Negative side margins in both standard and custom symbols, giving you greater control over horizontal alignment
    • Localized symbol variants for right-to-left writing systems, as well as script-specific symbols for Arabic, Devanagari, and Hebrew

    Usage

    UIKit:

    let heartImage = UIImage(systemName: "heart.fill")
    

    SwiftUI:

    let heartImage = Image(systemName: "heart.fill")
    
    0 讨论(0)
提交回复
热议问题