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

Message Toast

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

A new-message toast with avatar.

Banners · SwiftUI · iOS 17

  • banners
  • swiftui

The actual source

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

import SwiftUI

// Message toast (avatar + preview)
struct MessageToast: View {
    var body: some View {
        HStack(spacing: 12) {
            Image("person_2").resizable().scaledToFill().frame(width: 40, height: 40).clipShape(Circle())
            VStack(alignment: .leading, spacing: 2) { Text("James Wilson").font(.system(size: 14, weight: .semibold)).foregroundStyle(.white); Text("Sounds great, see you then!").font(.system(size: 13)).foregroundStyle(.white.opacity(0.7)).lineLimit(1) }
            Spacer(minLength: 8)
            Image(systemName: "arrowshape.turn.up.left.fill").font(.system(size: 15)).foregroundStyle(.white.opacity(0.8))
        }.padding(12).frame(width: 330).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 · 1 dependencies

Dependencies

SwiftUI
  • person_2 (image asset)

Requires iOS 17