NatChip

public final class NatChip : UIView

NatChip is a class that represents the Chip component from the design system.

Example of usage:

let chip = NatChip(size: .semi, color: .neutral)
chip.configure(text: "NatChip example text")
chip.configure(icon: getIcon(.outlinedDefaultMockup), position: .left)
chip.configure(avatar: natAvatar, position: .right)
chip.configure(state: .normal)
chip.configure(actionHandler: { isSelect in
   //do something
})

Requires

It’s necessary to configure the Design System with a theme or fatalError will be raised.

DesignSystem().configure(with: AvailableTheme)

Private properties

Public properties

  • Undocumented

    Declaration

    Swift

    public private(set) var state: UIControl.State { get set }
  • Undocumented

    Declaration

    Swift

    public private(set) var isSelected: Bool { get set }
  • Undocumented

    Declaration

    Swift

    public private(set) var theme: AvailableTheme { get set }
  • Undocumented

    Declaration

    Swift

    public var color: ThemeColor { get set }

Init

Public Methods

  • Sets the text of the component.

    Example of usage:

    natChip.configure(text: "NatChip example text")
    

    Declaration

    Swift

    public func configure(text: String)

    Parameters

    text

    A String that set the text of the component

  • Sets an icon to the component.

    Example of usage:

    natChip.configure(icon: getIcon(.outlinedDefaultMockup), position: .left)
    

    Declaration

    Swift

    public func configure(icon: String?, position: NatChip.Position)

    Parameters

    icon

    A String that set an icon to the component

    position

    A NatChip.Position that indicates the position of the icon

  • Sets an avatar to the component.

    Example of usage:

    natChip.configure(avatar: natAvatar, position: .left)
    

    Declaration

    Swift

    public func configure(avatar: NatAvatar, position: NatChip.Position)

    Parameters

    avatar

    A NatAvatar that set an avatar to the component

    position

    A NatChip.Position that indicates the position of the avatar

  • Sets the state of the component.

    Example of usage:

    natChip.configure(state: .normal)
    

    Declaration

    Swift

    public func configure(state: UIControl.State)

    Parameters

    state

    An UIControl.State that changes the state of the component

  • Sets the handler to be executed when isSelected value changes

    Example of usage:

    natChip.configure { isSelected in }
    

    Declaration

    Swift

    public func configure(actionHandler: @escaping (Bool) -> Void)

    Parameters

    actionHandler

    A closure to notify value change

  • Undocumented

    Declaration

    Swift

    public func configure(color: Color)
  • Undocumented

    See more

    Declaration

    Swift

    public enum Color
  • Undocumented

    See more

    Declaration

    Swift

    public struct ThemeColor
  • Undocumented

    See more

    Declaration

    Swift

    public enum Position
  • Size is an enum that represents the possible sizes for the NatChip size. The default size is semi.

    These are all sizes allowed for a NatChip:

    • semi
    • semiX
    • medium
    See more

    Declaration

    Swift

    public enum Size : CaseIterable