Skip to content
Achievement Toast preview
Rendered from the SwiftUI source on this page.

Achievement Toast

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

An achievement-unlocked toast.

Banners · SwiftUI · iOS 17

  • banners
  • swiftui

The actual source

AchievementToast.swift
// Achievement Toast · syxUI · https://syxui.dev/components/bt-achievement
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Achievement toast
struct AchievementToast: View {
    var body: some View {
        HStack(spacing: 12) {
            Image(systemName: "trophy.fill").font(.system(size: 22)).foregroundStyle(Color(red: 0.98, green: 0.72, blue: 0.10))
            VStack(alignment: .leading, spacing: 2) { Text("Achievement Unlocked!").font(.system(size: 14, weight: .bold)).foregroundStyle(.white); Text("7-day streak · +50 XP").font(.system(size: 12)).foregroundStyle(.white.opacity(0.75)) }
            Spacer(minLength: 8)
        }.padding(14).frame(width: 320).background(Color(red: 0.15, green: 0.15, blue: 0.17), in: RoundedRectangle(cornerRadius: 16, style: .continuous)).shadow(color: .black.opacity(0.15), radius: 12, y: 5)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17