@young I think the source of your confusion is that Xcode shows the documentation for the struct itself, even though what you're clicking on is actually the initializer.
Try this:
import SwiftUI
/// A very very ordinary view
struct AView: View {
/// A parameter
let a: String
/// Another parameter
let b: String
/// The body
var body: some View {
Text("\(a) -- \(b)")
}
/// Creates a view.
///
/// - Parameters:
/// - a: a is a parameter
/// - b: b is another parameter
init(a: String, b: String) {
self.a = a
self.b = b
}
}
AView(a: "a", b: "b")
Then Option-click on the a:
or b:
part of AView(a: "a", b: "b")
, not on the type name AView
.
I assume this behavior is intentional, as it shows you the documentation for the type you've just clicked on, but yes, it's confusing if what you wanted to see was the documentation for the initializer.