Menu
Coddy logo textTech

SF Symbols

Part of the Introduction to SwiftUI section of Coddy's Swift journey. Lesson 7 of 50.

Apple ships thousands of icons called SF Symbols. Show one with Image(systemName:) and its name:

Image(systemName: "heart.fill")
    .font(.largeTitle)
    .foregroundStyle(.red)

A symbol behaves like text: .font sets its size and .foregroundStyle its color. Names ending in .fill are the filled versions, such as star and star.fill.

A Label puts an icon and a title side by side:

Label("Settings", systemImage: "gear")
challenge icon

Challenge

Easy

Replace the text with a Label titled Favorites that shows the star.fill symbol.

Try it yourself

import SwiftUI

@main
struct CoddyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Introduction to SwiftUI

Practice on your own: Swift playground