如何在Swift中找到运算符定义? [英] How can I find the operator definition in Swift?
问题描述
我在下面写代码:
let array1: [Int] = [0,1]
let array2 = array1 + [2]
它能正常工作.我想找到+
运算符定义的位置.我在工作区中搜索ArrayExtension而没有结果.我搜索Apple doc Collection
Sequence
Array
,没有结果.
It just works.I want to find where +
operator define. I search ArrayExtension in my workspace without result.I search Apple doc Collection
Sequence
Array
, there is no result.
是否有导航到operator definition
的方法,例如CMD + CTRL + J
表示func
Is there a way to navigate to operator definition
,like CMD + CTRL + J
for func
推荐答案
您可以在Xcode源代码编辑器中选择运算符,然后从菜单中选择导航->跳转到定义",或按CMD + CTRL + J.
You can select the operator in the Xcode source editor, and choose "Navigate -> Jump to definition" from the menu, or press CMD+CTRL+J.
(这在Xcode 10中已被打破,但在当前处于beta版的Xcode 11中又可以使用.)
(This was broken in Xcode 10, but works again in Xcode 11, which is currently in beta.)
这篇关于如何在Swift中找到运算符定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!