objective-c 如何在 xcode 快速新建一个对象

2017-09-08 09:27:30 +08:00
 NonClockworkChen
Does a keyboard shortcut exist or is there a way to create a custom shortcut for allocating and initializing a class? Say we have:

MyCustomClass customClass =

At this point there should be an autocomplete option to:

MyCustomClass customClass = [[MyCustomClass alloc] init];

这也是 Stack Overflow 上提问的一个,可惜无人问津.
1323 次点击
所在节点    问与答
4 条回复
TangMonk
2017-09-08 09:32:08 +08:00
关键字:Xcode Snippets

http://nshipster.com/xcode-snippets/
wohenyingyu02
2017-09-08 10:18:31 +08:00
实际开发过程中不太会用到这种直白的新建,快速好像没有太大意义
maxxxxx
2017-09-08 10:29:24 +08:00
没必要吧,init 方法那么多,很难补全到自己想要的
hoogle
2017-09-08 10:35:39 +08:00
1 楼正解。可以加下面的 code spippet 到 Xcode,不过感觉并没必要

<#Class#> *<#var#> = [[<#Class#> alloc] init];

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/389091

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX