We all know that when documenting a struct, you can use @struct for your struct and use @field to explains the content within the struct.
But how to document a struct with some fields that is within another struct?
In Swift, the example code will be:
struct Constants{
static let kButtonHeight : CGFloat = 0
struct Color {
static let kCloud: UIColor = UIColor(red: 236/255, green: 240/255, blue: 241/255, alpha: 1.0)
}
}
Thank you so much!
If you're doing this in Swift, you can prefix anything (type, property, or instance, etc.) with either single-line comments marked by /// or multi-line comments beginning with /**. So your documentation could simply be:
/// A global container for all constants
struct Constants{
/// The default button height
static let kButtonHeight : CGFloat = 0
/// Constant UIColor instances for my app
struct Color {
/// The cloud color - a very pale blue-white
static let kCloud: UIColor = UIColor(red: 236/255, green: 240/255, blue: 241/255, alpha: 1.0)
}
}
The documentation attaches immediately -- option click on a name and you get the relevant documentation:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With