ImageSource

Describes where an image comes from, without touching UIKit.
public sealed record ImageSource

Properties

Kind

How Value should be resolved.

Type: ImageSourceKind

public ImageSourceKind Kind { get; }

PrefersMulticolor

Whether a symbol with a built-in multicolor rendition should use it.

Type: bool

public bool PrefersMulticolor { get; }

SymbolColors

Colors for the symbol's layers: one gives the hierarchical look, while several define a palette.

Type: IReadOnlyList<Color>

public IReadOnlyList<Color> SymbolColors { get; }

SymbolScale

The symbol's relative scale within its font metrics.

Type: SymbolScale

public SymbolScale SymbolScale { get; }

SymbolSize

The symbol's point size, or NaN to let the consuming control choose.

Type: double

public double SymbolSize { get; }

SymbolWeight

The symbol's stroke weight, or null to let the consuming control choose.

Type: FontWeight?

public FontWeight? SymbolWeight { get; }

Value

The symbol name, bundle asset name, or URL.

Type: string

public string Value { get; }

Methods

Bundle

An image from a bundle asset name.

public static ImageSource Bundle(
  string name)
ParameterSummary
string nameThe name of the asset in the bundle.

Returns

  • ImageSource: An image source configured for a bundle asset.

Data

An image from raw encoded bytes.

public static ImageSource Data(
  byte[] bytes)
ParameterSummary
byte bytesThe encoded image data.

Returns

  • ImageSource: An image source configured for in-memory data.

Symbol

An image from an SF Symbol name.

public static ImageSource Symbol(
  string name)
ParameterSummary
string nameThe name of the system symbol.

Returns

Symbol

An image from an SF Symbol name with rendering configuration.

public static ImageSource Symbol(
  string name,
  double size = NaN,
  FontWeight? weight = null,
  SymbolScale scale = Default,
  bool prefersMulticolor = false,
  params Color[] colors)
ParameterSummary
string nameThe name of the system symbol.
(optional) double sizeThe symbol's point size, or NaN to let the consuming control choose.
(optional) FontWeight? weightThe symbol's stroke weight, or null to let the consuming control choose.
(optional) SymbolScale scaleThe symbol's relative scale within its font metrics.
(optional) bool prefersMulticolorWhether to prefer the symbol's built-in multicolor rendition.
Color colorsColors for hierarchical or palette rendering.

Returns

Url

An image from a remote URL, loaded asynchronously.

Supported by Image.Source and sharing. Compact control icons accept local sources only.

public static ImageSource Url(
  string url)
ParameterSummary
string urlThe full web address of the image.

Returns

Operators

Implicit ImageSource(string)

Treats a string as a URL when it looks like one, otherwise resolves it automatically.

public static implicit operator ImageSource(
  string value)
ParameterSummary
string valueThe string value to convert.

Returns