cupertino-sample-code/coredata-sharing-core-data-objects-between-icloud-users/SwiftUI/FullImageView.swift
Mihaela Mihaljevic 37fd4fb24f Initial commit: 606 Apple sample code projects
MIT License - Apple Developer sample code
Downloaded via Cupertino (https://github.com/mihaelamj/cupertino)
2025-12-03 00:19:12 +01:00

45 lines
1.2 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
See the LICENSE.txt file for this samples licensing information.
Abstract:
A SwiftUI view that shows a scrollable full-size image.
*/
import SwiftUI
import CoreData
struct FullImageView: View {
@Binding var activeSheet: ActiveSheet?
var photo: Photo
private var photoImage: UIImage? {
let photoData = photo.photoData?.data
return photoData != nil ? UIImage(data: photoData!) : nil
}
var body: some View {
NavigationStack {
VStack {
if let image = photoImage {
ScrollView([.horizontal, .vertical]) {
Image(uiImage: image)
}
} else {
Text("The full size image is probably not downloaded from CloudKit.").padding()
Spacer()
}
}
.toolbar {
ToolbarItem(placement: .dismiss) {
Button("Dismiss") {
activeSheet = nil
}
}
}
.listStyle(.plain)
.navigationTitle("Full Size Photo")
}
.frame(idealWidth: Layout.sheetIdealWidth, idealHeight: Layout.sheetIdealHeight)
}
}