Custom Pull to Refresh

Custom Pull to Refresh

A scroll view with a hand-made refresh indicator: a liquid droplet that stretches and fills as you pull, flips its arrow with a haptic past the threshold, then spins while your async refresh runs. When the work finishes it shows a check, plays a success haptic, springs closed, and the new rows slide in.

Luiz Mello
  • list
  • loading
  • gesture

snippet.swift484 lines

7 files • Scroll to see all →
/// One row of sample activity for `CustomPullToRefresh` previews and demos.public struct CustomPullToRefreshItem: Identifiable, Equatable {    public let id: UUID    public let title: String    public let subtitle: String    public let systemImage: String    public let color: Color    public let time: String​    public init(title: String, subtitle: String, systemImage: String, color: Color, time: String) {        self.id = UUID()        self.title = title        self.subtitle = subtitle        self.systemImage = systemImage        self.color = color        self.time = time    }​    public static let samples: [CustomPullToRefreshItem] = [        .init(title: "Maya Chen", subtitle: "Shared “Q4 Roadmap” with you", systemImage: "doc.richtext.fill", color: .blue, time: "9:41"),​// ... (click "Show full code" to see more)
Viewing: Model.swift•1 of 7