Skip to content

Commit 0485eec

Browse files
authored
Use InputField in GenerativeAITextExample (#1727)
1 parent ceca33e commit 0485eec

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

firebaseai/GenerativeAITextExample/Screens/GenerateContentScreen.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import MarkdownUI
1616
import SwiftUI
1717
import FirebaseAI
18+
import GenerativeAIUIComponents
1819

1920
struct GenerateContentScreen: View {
2021
let firebaseService: FirebaseAI
@@ -39,18 +40,11 @@ struct GenerateContentScreen: View {
3940
VStack(alignment: .leading) {
4041
Text("Enter some text, then tap on _Go_ to run generateContent on it.")
4142
.padding(.horizontal, 6)
42-
HStack(alignment: .top) {
43-
TextField("Enter generate content input", text: $userInput, axis: .vertical)
44-
.focused($focusedField, equals: .message)
45-
.textFieldStyle(.roundedBorder)
46-
.onSubmit {
47-
onGenerateContentTapped()
48-
}
49-
Button("Go") {
50-
onGenerateContentTapped()
51-
}
52-
.padding(.top, 4)
43+
InputField("Enter generate content input", text: $userInput) {
44+
Text("Go")
5345
}
46+
.focused($focusedField, equals: .message)
47+
.onSubmit { onGenerateContentTapped() }
5448
}
5549
.padding(.horizontal, 16)
5650

0 commit comments

Comments
 (0)