For method calls with external parameter names I can cmd-click in Xcode on any parameter name to jump to the method definition. For
example, in
let a = Array(count: 3, repeatedValue: 0)
a cmd-click on "count" or "repeatedValue" jumps directly to the Array
initializer method
init(count: Int, repeatedValue: Element)
However, I haven't found a way to do the same for methods calls
without external parameter names, as in
let c = Array("abc".characters)
Of course I can lookup that the characters
method returns a String.CharacterView
which in turn conforms to SequenceType
, so this will call the Array
initializer
init<S : SequenceType where S.Generator.Element == _Buffer.Element>(_ s: S)
but I wonder if somebody has found a direct "jump to definition" method
for this situation.
This would be very useful if a type has many overloaded init methods (without external parameter names), to determine which one is actually called.
The above examples are from Swift 2/Xcode 7 beta, but the problem is not
tied to a special Swift/Xcode version.
(Also posted at the Apple Developer Forums: https://forums.developer.apple.com/thread/12687.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…