
Pinch Photo Grid
A photo library grid where pinching changes the column count continuously from one to six, every tile morphing to its new frame while the photo under your fingers stays put. On release it springs to the nearest count, and tapping a tile opens it with a zoom transition.
- grid
- gallery
- gesture
snippet.swift347 lines
7 files • Scroll to see all →
/// One photo in a `PinchPhotoGrid`. The "image" is a gradient plus an SF/// Symbol, so the snippet needs no assets.public struct PinchPhotoGridPhoto: Identifiable, Hashable { public let id: Int public let title: String public let date: String public let systemImage: String /// Two colors for the diagonal gradient. public let colors: [Color] public init(id: Int, title: String, date: String, systemImage: String, colors: [Color]) { self.id = id self.title = title self.date = date self.systemImage = systemImage self.colors = colors.isEmpty ? [.gray, .gray] : colors } public static let samples: [PinchPhotoGridPhoto] = { let places = ["Lisbon", "Porto", "Sintra", "Madeira", "Algarve", "Cascais", "Évora", "Nazaré"]// ... (click "Show full code" to see more)Viewing: Model.swift•1 of 7