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

Photo Viewer

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

A photo viewer with a bottom action bar.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

PhotoViewer.swift
// Photo Viewer · syxUI · https://syxui.dev/components/media2-photo-viewer
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Photo viewer with actions
struct PhotoViewer: View {
    var body: some View {
        VStack(spacing: 0) {
            Image("photo_pet").resizable().scaledToFill().frame(width: 300, height: 240).clipped()
            HStack(spacing: 26) {
                Image(systemName: "heart").font(.system(size: 20))
                Image(systemName: "bubble.right").font(.system(size: 20))
                Image(systemName: "paperplane").font(.system(size: 20))
                Spacer()
                Image(systemName: "bookmark").font(.system(size: 20))
            }.foregroundStyle(.white).padding(.horizontal, 16).padding(.vertical, 14).frame(width: 300).background(Color(red: 0.12, green: 0.12, blue: 0.14))
        }.frame(width: 300).clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • photo_pet (image asset)

Requires iOS 17