Skip to content
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

Document parameters of all initializers #2

Closed
vojtamolda opened this issue Feb 6, 2020 · 1 comment
Closed

Document parameters of all initializers #2

vojtamolda opened this issue Feb 6, 2020 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@vojtamolda
Copy link
Owner

vojtamolda commented Feb 6, 2020

Currently, the init(...) call of every trace accepts a ridiculously large number of parameters (see #1 for details). It would be nice if the documentation visible in XCode after the option click option-click and eventually in Jazzy displayed the full list of the parameters. Each with a simple, single sentence description.

The purpose is two fold - first to give a brief explanation of functionality and second to provide a way to quickly lookup the order of parameters. Unfortunately, Swift in contrast to Python keyword arguments, requires that all calls of a function have parameter order identical to the definition.

Not following the order frequently leads to a strange and misleading compiler errors and a general sub-par user experience. The code-(de)generated initializers tend to have around 50 of these order-sensitive arguments. Sorting them is even not fun when one has to scroll up-and-down the source code of the constructed trace.

Desired result should follow the XCode markdown format and look something like this:

/// A simplified Scatter trace initializer.
///
/// - Parameters:
///   - name: Name of the trace that shows up in the legend.
///   - x: Plotable vector of `x` values.
///   - y: Plotable vector of `y` values.
///   - marker: Single marker style or an array of individual styles for each data point.
///   - line: Style of the trace line.
///   - mode: Arbitrary combination of `.line`, `.marker`, or `.text`.
///
init(name: String? = nil, x: XData? = nil, y: YData? = nil,
     marker: Marker? = nil, line: Line? = nil, mode: Mode? = nil)
@vojtamolda vojtamolda added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Feb 6, 2020
@vojtamolda vojtamolda added this to the Plotly.swift 0.2.0 milestone Feb 6, 2020
vojtamolda added a commit that referenced this issue Feb 12, 2020
- Separate Markup struct for formatting of documentation
- Better documentation for all initializers
- Simple inits only for traces
vojtamolda added a commit that referenced this issue Feb 13, 2020
- Separate Markup struct for formatting of documentation
- Better documentation for all initializers
- Simple inits only for traces
@vojtamolda vojtamolda self-assigned this Feb 13, 2020
vojtamolda added a commit that referenced this issue Feb 13, 2020
- Separate Markup struct for formatting of documentation
- Better documentation for all initializers
- Simple inits only for traces
@vojtamolda
Copy link
Owner Author

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant