Skip to content
Profile Avatar preview
Rendered from the SwiftUI source on this page.

Profile Avatar

From syxUI — written for both platforms, not translated between them.

A large profile avatar with name and handle.

Avatars · SwiftUI · iOS 17

  • avatars
  • swiftui

The actual source

AvatarProfile.swift
// Profile Avatar · syxUI · https://syxui.dev/components/avatar-profile
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let avGreen = Color(red: 0.16, green: 0.66, blue: 0.40)

func av(_ name: String, _ d: CGFloat) -> some View { Image(name).resizable().scaledToFill().frame(width: d, height: d).clipShape(Circle()) }

struct AvatarProfile: View { var body: some View { VStack(spacing: 10) { av("person_5", 88).overlay(alignment: .bottomTrailing) { Circle().fill(avGreen).frame(width: 20, height: 20).overlay(Circle().stroke(Color(.systemBackground), lineWidth: 3)) }; VStack(spacing: 2) { Text("Sarah Miller").font(.system(size: 18, weight: .semibold)); Text("@sarahm").font(.system(size: 13)).foregroundStyle(.secondary) } } } }
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_5 (image asset)

Requires iOS 17