Instance Property インスタンスプロパティ

symbolVariants

The symbol variant to use in this environment.

Declaration 宣言

var symbolVariants: SymbolVariants { get set }

Discussion 議論

You set this environment value indirectly by using the symbolVariant(_:) view modifier. However, you access the environment variable directly using the environment(_:_:) modifier. Do this when you want to use the none variant to ignore the value that’s already in the environment:


HStack {
    Image(systemName: "heart")
    Image(systemName: "heart")
        .environment(\.symbolVariants, .none)
}
.symbolVariant(.fill)

A screenshot of two heart symbols. The first is filled while the

See Also 参照

View Attributes