Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Added additional documentation and example code snippet. #2156
Added additional documentation and example code snippet. #2156
Changes from 1 commit
6808a8c
12d2272
93fa956
1d4725e
b142ab7
9551c9b
9bf6bca
1b461a6
a86eea6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 really appreciate the effort, but you are not supposed to add code examples to the API docs in this way. See this link for an example https://blog.golang.org/examples on how it should be done for interactive examples.
However, we do have the
fyne_demo
application so I don't know if we really should add this kind of example in (someone else will have to comment on that) because adding it to one function would mean that we open up the possibility of adding to much more functions in the future.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.
The interactive examples are normally able to be executed as a test and in the browser and I'm not sure how to get something like that to work in this case where it's rendering a GUI dialog box. That's why I just put in in a code snippet as an example similar to what Go's doc do for similar cases (e.g. https://golang.org/pkg/net/).
It's perfectly alright with me if this is not the right fit for the project so please feel free to reject the PR.
If the
fyne_demo
has the illustrative snippet of code, my suggestion would be to add a direct reference to it somehow in the doc to make it easy to find. A demo app's source code (especially one as complete as the demo) isn't as easily navigable IMHO so help to get to the right part would help.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.
Fyne code can be rendered in the playground in theory, but there is a 5sec timeout that I am sure means we can’t get the app compiled (you could check out the tools/playground package though).
With WASM aiming for 2.1 this may get much better :)
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 am nervous about adding code examples like this (i.e. entire applications) because it includes so much outside the scope of this function. Linking to the fyne_demo project could be a nice way to do it, though those links may go stale as well.
I liked what was done with the clarification in the paragraph of text above the example, but feel that large examples like this would be better placed in the tutorials at https://developer.fyne.io.