From f753a6bec57bb76f8cb2ba78ce3208c1b8fb6be3 Mon Sep 17 00:00:00 2001 From: Bruno Muniz Azevedo Filho <bruno@elixxir.io> Date: Tue, 28 Jun 2022 03:08:30 -0300 Subject: [PATCH] Improving ux w/ avatar view substring --- Sources/Shared/Views/AvatarView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Shared/Views/AvatarView.swift b/Sources/Shared/Views/AvatarView.swift index 93a4789f..a1104edb 100644 --- a/Sources/Shared/Views/AvatarView.swift +++ b/Sources/Shared/Views/AvatarView.swift @@ -48,6 +48,12 @@ public final class AvatarView: UIView { public func setupProfile(title: String, image: Data?, size: AvatarView.Size) { iconImageView.image = nil + monogramLabel.text = title + .trimmingCharacters(in: .whitespacesAndNewlines) + .replacingOccurrences(of: " ", with: "") + .prefix(2) + .uppercased() + monogramLabel.text = "\(title.prefix(2))".uppercased() // TODO: What are the font sizes and corner radius for small/medium avatars? -- GitLab