Autoimplement斯威夫特协议方法

Autoimplement斯威夫特协议方法

本文介绍了以x code Autoimplement斯威夫特协议方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始迅速语言,从Java未来它看起来很棒至今。
但我真的失去了一些东西:

I just started with the swift language and coming from java it looks great so far.But I'm really missing something:

Eclipse中有这样伟大的功能,当我说实现了XYZ它为我提供了一个功能可自动执行必要的功能存根。这是一个巨大的节省时间。

Eclipse had this great feature that when I added "implements XYZ" it provided me a function to automatically implement the necessary function stubs. This is a huge timesaver.

X $ C $ç似乎并不具备此功能,还是我失去了一些东西?

XCode doesn't seem to have this feature, or am I missing something?

我发现使用配件插件,但这似乎只能用Objective C的工作..

I found the accessorize plugin, but this seems only to work with Objective C..

有没有解决方案?

PS。我用X code 6.1.1

PS. I'm using XCode 6.1.1

推荐答案

我刚刚创建的是iOS项目,并领导到我UIViewController.swift文件。在那里,我宣布,它实施的UITableViewDelegate:

I just created an iOS project, and headed into my UIViewController.swift file. There I declared that it implemented UITableViewDelegate:

class ViewController: UIViewController, UITableViewDelegate {

现在,当我进入类的主体,并开始输入选项卡上......,我看到了相应的自动填充功能:

Now when I go into the body of the class, and start typing "tab...", I see the appropriate autocompletions:

按输入然后插入函数存根,将光标置于准备code。

Hitting then inserts the function stub, with the cursor placed ready to code.

这只是顺便X $ C $Ç自动完成的协议(或继承类的方法。)如果你想要做的所有的人一下子,我不认为这是可能的,可悲的。但你总是可以 Cmd的单击鼠标右键或选项 - Cmd的上单击鼠标右键协议名称(使用辅助编辑器窗口)跳转到它顾名思义,这基本上是所有的方法,你可以复制并粘贴到你的code列表。你需要从那里收拾了一点,但不多。

That's just the way Xcode autocompletes protocols (or inherited class methods.) If you want to do all of them at once, I don't think it's possible, sadly. But you can always -click or --click (which uses a secondary editor window) on the protocol name to jump to its definition, which is basically a list of all its methods you can copy and paste into your code. You'd need to tidy up a little from there, but not much.

这篇关于以x code Autoimplement斯威夫特协议方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 01:42