Skip to content

Commit

Permalink
doc: update document.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 10, 2024
1 parent f47c07e commit ac5221b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ import SwiftUI

struct ContentView: View {
@State private var searchText = ""
var body: some View {
SearchField(searchText: $searchText, placeholder: "Search...", searchField: { searchField in
print(type(of: searchField)) // -> NSSearchField
})
var body: some View {
SearchField(
searchText: $searchText,
placeholder: "Search...",
searchField: { searchField in
print(type(of: searchField)) // -> NSSearchField
}
)
}
}
```
Expand Down Expand Up @@ -142,9 +146,13 @@ struct ContentView: View {
@State private var searchText = ""

var body: some View {
SearchField(searchText: $searchText, placeholder: "Search...", searchField: { text in
print("Search text changed to: \(text)")
})
SearchField(
searchText: $searchText,
placeholder: "Search...",
searchField: { searchField in
print(type(of: searchField)) // -> NSSearchField
}
)
}
}
```
Expand Down
9 changes: 9 additions & 0 deletions SearchFieldExample/SearchFieldExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ struct ContentView: View {
.foregroundStyle(.tint)
Text("Hello, Search Field!")


SearchField(
searchText: $searchText,
placeholder: "Search...",
searchField: { searchField in
print(type(of: searchField)) // -> NSSearchField
}
)

SearchField(searchText: $searchText, placeholder: "Search...", searchField: { searchField in
print(type(of: searchField)) // -> NSSearchField
})
Expand Down

0 comments on commit ac5221b

Please sign in to comment.