diff --git a/JustScanIt/View/ScanItemView.swift b/JustScanIt/View/ScanItemView.swift index de9f4d4..dacea19 100644 --- a/JustScanIt/View/ScanItemView.swift +++ b/JustScanIt/View/ScanItemView.swift @@ -9,6 +9,7 @@ import SwiftUI struct ScanItemView: View { @Environment(\.modelContext) var ctx + @Namespace private var animation @State private var isZoomed = false @@ -26,12 +27,13 @@ struct ScanItemView: View { Image(uiImage: scan.uiImages.first ?? UIImage(systemName: "questionmark")!) .resizable() .scaledToFit() + .matchedGeometryEffect(id: "images", in: animation) .frame(maxWidth: 70, maxHeight: 70) .padding(4) .background(translucentColour) .clipShape(RoundedRectangle(cornerRadius: 12)) .onTapGesture { - withAnimation(.linear) { + withAnimation(.spring) { isZoomed = true } } @@ -85,12 +87,13 @@ struct ScanItemView: View { .scaledToFit() .frame(maxHeight: 400) .onTapGesture { - withAnimation(.linear) { + withAnimation(.spring) { isZoomed = false } } } } + .matchedGeometryEffect(id: "images", in: animation) .frame(height: 400) .tabViewStyle(PageTabViewStyle()) }