CustomAvatar
is a SwiftUI component designed to display user avatars. It supports both URL-based images and fallback text-based avatars. Customize the fallback background and foreground colors, as well as the dimensions of the avatar.
Avatar
Avatar with fallback text
CustomAvatar.swift
file in your SwiftUI project. File Link
imageURL: String
- The URL of the image to display.fallbackText: String
- The text to display if the image loading fails.width: CGFloat
- The width of the avatar view.height: CGFloat
- The height of the avatar view.fallbackBgColor: Color
- Background color for the fallback view. Default: .black
.fallbackFgColor: Color
- Foreground color for the fallback text. Default: .white
.CustomAvatar
component: