CNSymbol class

Describes an SF Symbol to render natively.

SF Symbols are vector-based icons from Apple's comprehensive library. This class encapsulates symbol configuration for native rendering in iOS/macOS widgets.

The symbol rendering is performed natively using UIImage(systemName:) for maximum compatibility and performance.

Properties

  • name: The SF Symbol name (e.g., 'star.fill', 'chevron.down')
  • size: Point size for display (default: 24.0)
  • color: Icon color (used in monochrome/hierarchical modes)
  • paletteColors: Custom colors for palette mode (up to 4 colors)
  • mode: Rendering mode (monochrome, hierarchical, palette, multicolor)
  • gradient: Whether to use built-in gradients when available

Finding Symbol Names

Use Apple's SF Symbols app (available on Mac App Store) to browse all 4500+ available symbols. Symbols are named with dot notation (e.g., 'heart.fill', 'square.and.arrow.up').

Performance Notes

  • Symbol rendering is hardware-accelerated on native side
  • Symbols are cached after first render
  • Size changes are more efficient than rasterizing custom images
  • Rendering is optimized for dark mode automatically

Constructors

CNSymbol(String name, {double size = 24.0, Color? color, List<Color>? paletteColors, CNSymbolRenderingMode? mode, bool? gradient})
Creates a symbol description for native rendering.
const

Properties

color → Color?
Preferred icon color (for monochrome/hierarchical modes).
final
gradient → bool?
Whether to enable the built-in gradient when available.
final
hashCode → int
The hash code for this object.
no setterinherited
mode → CNSymbolRenderingMode?
Optional per-icon rendering mode.
final
name → String
The SF Symbol name, e.g. chevron.down.
final
paletteColors → List<Color>?
Palette colors for multi-color/palette modes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → double
Desired point size for the symbol.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited