Skip to content

Instantly share code, notes, and snippets.

View satishVekariya's full-sized avatar

Satish satishVekariya

  • UK
View GitHub Profile
@satishVekariya
satishVekariya / List+StretchyBackground.swift
Last active May 31, 2024 22:08
These modifiers are designed to observe changes in the view's bounds and provide a stretchy background effect for a list.
import SwiftUI
/// These modifiers are designed to observe changes in the view's bounds and provide a stretchy background effect for a list.
///
/// Source: https://gist.github.com/satishVekariya/c52477b6acafdf200606335e39a37382
public extension View {
/// List/View bound change observer
///
/// Mostly you need to use this on List cell
///
@satishVekariya
satishVekariya / UnknownProgressIndicator.swift
Created August 16, 2024 18:40
Unknown progress indicator view
struct UnknownProgressIndicator: View {
var size: CGFloat = 100
var primaryColor = Color(red: 1.0, green: 0.5, blue: 0.4)
var bgColor = Color(red: 0.155, green: 0.041, blue: 0.3)
var animationCycleTime: CGFloat = 3.5
@State private var rotation: CGFloat = 90
var body: some View {
Circle()
@satishVekariya
satishVekariya / SwiftUITask+Polling.swift
Created July 8, 2025 16:20
Adds a polling task to a SwiftUI view that repeatedly performs an asynchronous action at a specified interval.
import SwiftUI
public extension View {
/// Adds a polling task to a SwiftUI view that repeatedly performs an asynchronous action at a specified interval.
///
/// This method wraps SwiftUI's `.task(id:priority:)` modifier to repeatedly invoke a given asynchronous `action`
/// until the task is cancelled. It is useful for scenarios like periodic data refreshing.
///
/// - Parameters:
/// - value: A value to identify the task. Changing this value will cancel and restart the task. Must conform to `Equatable`.