Xcode中的自动实现Swift协议方法 [英] Auto-implement Swift protocol methods in Xcode

查看:239
本文介绍了Xcode中的自动实现Swift协议方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是从敏捷的语言入手,到目前为止,它来自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.

Xcode似乎没有此功能,或者我缺少什么吗?

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

我找到了accessorize插件,但这似乎只适用于Objective C.

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

有解决方案吗?

PS.我正在使用Xcode 6.1.1

PS. I'm using Xcode 6.1.1

推荐答案

Xcode 9

Xcode 9现在支持通过修复它"来遵循协议方法.它将自动为您填充缺少的方法.这是在WWDC 2017中宣布的.

Xcode 9

Xcode 9 now supports conforming to protocol methods via a "fix it". It will automatically fill the missing methods for you. This was announced in WWDC 2017.

更新:不幸的是,这似乎不适用于您定义的协议.

Update: This doesn't seem to work for protocols defined by you, unfortunately.

这篇关于Xcode中的自动实现Swift协议方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆