Skip to content

Commit afe81fa

Browse files
add AvatarGroupVM and AvatarItemVM
1 parent 463cf9a commit afe81fa

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import UIKit
2+
3+
/// A model that defines the appearance properties for an avatar group component.
4+
public struct AvatarGroupVM: ComponentVM {
5+
/// The color of the placeholder.
6+
public var color: ComponentColor?
7+
8+
/// The corner radius of the avatar.
9+
///
10+
/// Defaults to `.full`.
11+
public var cornerRadius: ComponentRadius = .full
12+
13+
/// The array of avatars in the group.
14+
public var items: [AvatarItemVM] = []
15+
16+
/// The maximum number of visible avatars
17+
///
18+
/// Defaults to `5`.
19+
public var maxVisibleAvatars: Int = 5
20+
21+
/// The predefined size of the avatar.
22+
///
23+
/// Defaults to `.medium`.
24+
public var size: ComponentSize = .medium
25+
26+
/// Initializes a new instance of `AvatarVM` with default values.
27+
public init() {}
28+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import UIKit
2+
3+
/// A model that defines the appearance properties for an avatar in the group.
4+
public struct AvatarItemVM: ComponentVM {
5+
/// The source of the image to be displayed.
6+
public var imageSrc: AvatarVM.ImageSource?
7+
8+
/// The placeholder that is displayed if the image is not provided or fails to load.
9+
public var placeholder: AvatarVM.Placeholder = .icon("avatar_placeholder", Bundle.module)
10+
11+
/// Initializes a new instance of `AvatarItemVM` with default values.
12+
public init() {}
13+
}

0 commit comments

Comments
 (0)