Maintain consistent Swift style conventions throughout all code, including examples in documentation and comments. Follow these specific guidelines: 1. Use 4-space indentation for all Swift code
Maintain consistent Swift style conventions throughout all code, including examples in documentation and comments. Follow these specific guidelines:
For example:
// Correct
struct Model: Differentiable {
var parameter: Float
var allDifferentiableVariables: AllDifferentiableVariables {
get { return AllDifferentiableVariables(parameter: parameter) }
set { parameter = newValue.parameter }
}
}
// Incorrect
struct Model : Differentiable { // space before colon
var parameter: Float // 2-space indentation
var allDifferentiableVariables: AllDifferentiableVariables {
get { return AllDifferentiableVariables(parameter: parameter) }
set { parameter = newValue.parameter }
}
}
When showing code patterns that may be truncated (like in documentation examples), use โโฆโ to maintain symmetry and clarity of the pattern structure.
// Complete pattern with "..." for consistency
var allDifferentiableVariables: AllDifferentiableVariables {
get { return AllDifferentiableVariables(x: x, y: y, ...) }
set { x = newValue.x; y = newValue.y; ... }
}
Enter the URL of a public GitHub repository