Skip to content

Instantly share code, notes, and snippets.

View zhwayne's full-sized avatar

iya zhwayne

  • Hang Zhou
View GitHub Profile
@zhwayne
zhwayne / EditMenu.swift
Created September 21, 2023 09:44
EditMenu for SwiftUI
//
// EditMenu.swift
// CalcApp
//
// Created by iya on 2023/6/9.
// Copyright © 2023 wayne. All rights reserved.
//
import SwiftUI
import UIKit
@zhwayne
zhwayne / DebouncedChangeViewModifier.swift
Created April 10, 2023 01:49
Adds a modifier for this view that fires an action only when a time interval in DispatchTimeInterval represented by timeInterval elapses between value changes.
import SwiftUI
extension View {
/// Adds a modifier for this view that fires an action only when a time interval in
/// DispatchTimeInterval represented by `timeInterval` elapses between value changes.
///
/// Each time the value changes before `timeInterval` passes, the previous action will
/// be cancelled and the next action will be scheduled to run after that time passes
/// again. This mean that the action will only execute after changes to the value stay