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

Photo Message

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

A photo sent in a rounded bubble with a timestamp overlay.

Chat · SwiftUI · iOS 17

  • chat
  • swiftui

The actual source

ChatImageMessage.swift
// Photo Message · syxUI · https://syxui.dev/components/chat-image
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Photo message - image in a rounded bubble
struct ChatImageMessage: View {
    var body: some View {
        HStack {
            Spacer(minLength: 60)
            Image("photo_travel").resizable().scaledToFill().frame(width: 210, height: 160)
                .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
                .overlay(alignment: .bottomTrailing) {
                    Text("9:41 PM").font(.system(size: 11, weight: .medium)).foregroundStyle(.white)
                        .padding(.horizontal, 7).padding(.vertical, 3).background(.black.opacity(0.35), in: Capsule()).padding(8)
                }
        }
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • photo_travel (image asset)

Requires iOS 17