I am using Swift Markup Language to document class methods. Everything goes OK, but, here is a subtle issue.
Below goes a list of examples to explain what I am asking about.
1) Everything looks fine
/// My Fancy Method.
///
/// - Parameter number: A number.
/// - Parameter flag: A flag.
func methodWithoutCallback(integer number: Int, boolean flag: Bool) {
}
2) Still doing well
/// A method with callback (no arguments).
///
/// - Parameter string: A string.
/// - Parameter callback: A callback without arguments.
func methodWithVoidCallback(string name: String, _ callback: () -> ()) {
}
3) Not exactly what I've expected
/// This time things go wrong...
///
/// - Parameter number: A number.
/// - Parameter callback: Why there is a box with "No description" below?
func methodWithIntCallback(floating number: Float, _ callback: (Int) -> ()) {
}
4) Using typealias removes that thing away
typealias Callback = (Int) -> ()
/// And, there is a way to repair, but need typealias
///
/// - Parameter number: A number.
/// - Parameter callback: A callback (no box below)
func methodWithTypealiasedIntCallback(floating number: Float, _ callback: Callback) {
}
Did anybody have this issue? Or is it a kind of expected behavior? The issue comes up while using Xcode 9.2 (9C40b) and Swift 4 (if it matters).
UPDATE: Seems to be a duplicate of this question. But I wanted to clarify then: there is no way to ignore that box altogether, right? Because here is what you're getting if using proposed approach:
/// So, the box is coming up.
func methodWithCallbackParameterAnnotated(_ callback: (_ value: Int) -> Int) {
}