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

Notification Avatar

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

An avatar with an unread dot.

Avatars · SwiftUI · iOS 17

  • avatars
  • swiftui

The actual source

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

import SwiftUI

let avRed = Color(red: 0.90, green: 0.24, blue: 0.28)

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

struct AvatarNotification: View { var body: some View { av("person_3", 66).overlay(alignment: .topTrailing) { Circle().fill(avRed).frame(width: 16, height: 16).overlay(Circle().stroke(Color(.systemBackground), lineWidth: 2.5)) } } }
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_3 (image asset)

Requires iOS 17