
Fly to Cart
A product grid where tapping add sends a copy of the product artwork along a curved arc that shrinks into the cart icon. The bag bounces, its badge rolls up with numericText and a haptic lands with it.
- animation
- badge
- interaction
snippet.swift380 lines
7 files • Scroll to see all →
/// A product shown in the store grid. Artwork is a gradient tile with an SF Symbol.public struct FlyToCartProduct: Identifiable, Hashable { public let id: String public var name: String public var subtitle: String public var price: Double public var systemImage: String public var colors: [Color] public init(id: String, name: String, subtitle: String, price: Double, systemImage: String, colors: [Color]) { self.id = id self.name = name self.subtitle = subtitle self.price = price self.systemImage = systemImage self.colors = colors.isEmpty ? [.gray, .gray] : colors } public static let samples: [FlyToCartProduct] = [ FlyToCartProduct(id: "trail-runner", name: "Trail Runner", subtitle: "Ember · EU 42", price: 129,// ... (click "Show full code" to see more)Viewing: Model.swift•1 of 7