Skip to content

Instantly share code, notes, and snippets.

class ParentViewModel: ObservableObject {
@Published var counter1: Int = 0
@Published var counter2: Int = 0
}
/// When using an `ObservableObject`, the first mutation of any `@Published` property
/// triggers a full re-computation of the parent view and all of its child views.
/// This initial update causes both `CounterView` instances to lose their previous
/// identity and re-render. After this first invalidation pass, SwiftUI appears to
/// stabilize the view identities, and subsequent updates only re-render the
import SwiftUI
import Combine
// MARK: - The Handler
final class DebounceHandler<V: Equatable, S: Scheduler>: ObservableObject {
private let debounceTime: S.SchedulerTimeType.Stride
private let scheduler: S
private let action: (V, V) -> Void
private var previousValue: V
//
// Depth-Illusion-Example
//
// Created by Lidor Fadida on 24/01/2025.
//
import SwiftUI
//MARK: - Circle Configuration
struct CircleConfiguration: Identifiable, Hashable {
//
// Neumorphism.swift
// Neumorphism
//
// Created by Lidor Fadida on 21/01/2025.
//
struct NeumorphismPyramidView: View {
@State private var animate: Bool = false
@State private var animationProperties: [(Double, Double)] = Constants.range.map { index in
//
// OrbitView.swift
// PathTranslationEffectExample
//
// Created by Lidor Fadida on 17/01/2025.
//
import SwiftUI
struct OrbitView: View {
//MARK: - MarqueeEffectView.swift
struct MarqueeEffectView<Content: View>: View {
private let cycleDuration: TimeInterval
@Binding var isPaused: Bool
private let animationCycleDidComplete: (() -> Void)?
private let content: Content
@State private var xOffset: CGFloat = 0.0
@State private var deltaDate = Date.now