-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Swift Playground as an example #69
Conversation
}.padding() | ||
} | ||
|
||
func generateText() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename this to send
or sendMessage
, like in the other samples.
} | ||
Spacer() | ||
HStack { | ||
TextField("Enter a prompt...", text: $prompt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an onSubmit
handler so people can just hit [enter] to send the message.
Spacer() | ||
HStack { | ||
TextField("Enter a prompt...", text: $prompt) | ||
Button("Send", systemImage: "arrow.up.circle.fill") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a Button
with a nested Image
, like in the other samples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, thanks for putting this together!
I found it pretty difficult to edit the text in the Swift Playground app, as the code is formatted using 2 spaces, but the Playground app doesn't seem to allow changing the indentation width. So you constantly end up fighting the editor, which is a pretty bad user experience.
We should change the formatter configuration for this example.
Thanks for the review, @peterfriese! Closing this in favour of adding docs instead (#72). |
Added a starter Swift Playground for generating text from a prompt.