This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Depth-Illusion-Example | |
| // | |
| // Created by Lidor Fadida on 24/01/2025. | |
| // | |
| import SwiftUI | |
| //MARK: - Circle Configuration | |
| struct CircleConfiguration: Identifiable, Hashable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // OrbitView.swift | |
| // PathTranslationEffectExample | |
| // | |
| // Created by Lidor Fadida on 17/01/2025. | |
| // | |
| import SwiftUI | |
| struct OrbitView: View { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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 | |