CreationKit Documentation

Class Avatar

public final class Avatar: UIView  

Avatars are used to quickly identify users. When an image isn’t available, initials are used instead.

Avatar Avatar UIView UIView Avatar->UIView

Nested Types

Avatar.Size

Defines standard sizes for Avatar items in the design system Standard values are as follows. A .custom case exists for passing an arbitrary value.

Avatar.Configuration

Conforms To

UIView

Properties

name

public var name: String?  

The name of the user

image

public var image: UIImage?  

An image representing the user

text​Color

public var textColor: UIColor = ColorManager.Primary.fiveHundred  

The color used by the name label when no image is set

animation​Duration

public var animationDuration: TimeInterval = 0.25

The duration of the toggle animation. Set to 0 to disable animations.

is​Selected

@Published public var isSelected: Bool = false

Methods

name​ToInitials(_:​)

public static func nameToInitials(_ name: String) -> String  

layout​Subviews()

public override func layoutSubviews()  

touches​Began(_:​with:​)

public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)  

touches​Cancelled(_:​with:​)

public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?)  

touches​Ended(_:​with:​)

public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?)  

make(name:​image:​size:​content​Mode:​)

static func make(
    name: String?,
    image: UIImage?,
    size: Avatar.Size,
    contentMode: ContentMode = .scaleAspectFit
  ) -> Avatar  

Factory method for producing an Avatar component of a given size.

  • Tag: make

make​Group(size:​configurations:​)

static func makeGroup(size: Avatar.Size, configurations: [Configuration]) -> AvatarGroup  

Makes an AvatarGroup