DebouncedOnChange

1.0.2

SwiftUI onChange View extension with debounce time
Tunous/DebouncedOnChange

What's New

1.0.2

2023-01-14T15:58:03Z
  • tvOS and watchOS compatibility

DebouncedOnChange

A SwiftUI onChange view modifier with additional debounce time.

Usage

import SwiftUI
import DebouncedOnChange

struct ExampleView: View {
    @State private var text = ""

    var body: some View {
        TextField("Text", text: $text)
            .onChange(of: text, debounceTime: 2) { newValue in
                // Action executed each time 2 seconds pass since change of text property
            }
    }
}

Installation

Swift Package Manager

Add the following to the dependencies array in your "Package.swift" file:

.package(url: "https://github.com/Tunous/DebouncedOnChange.git", .upToNextMajor(from: "1.0.2"))

Or add https://github.com/Tunous/DebouncedOnChange.git, to the list of Swift packages for any project in Xcode.

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Mar 17 2023 17:04:28 GMT-0500 (GMT-05:00)