📜  如何知道文本何时更改文本字段 swiftui - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.384000             🧑  作者: Mango

代码示例1
import Combine
import SwiftUI

struct ContentView: View {
    @State var location: String = ""

    var body: some View {
        TextField("Search Location", text: $location)
            .onReceive(Just(location)) { location in
                // print(location)
            }
    }
}