[swift-users] Coding style for internal/private variables
Adrian Zubarev
adrian.zubarev at devandartist.com
Wed Jun 1 11:39:03 CDT 2016
A little bit off-topic: Is there any way to create autocompletion shortcuts in Xcode that will show only private, internal or both values of an instance?
class Foo {
private var integer: Int = 0
internal var string: String = "foo"
internal func boo() {}
}
let instance = Foo()
instance. at p
________________
|[V] Int integer |
|________________|
// where @p is an autocompletion shortcut for Xcode that will filter private vars, functions etc.
// when you choose one `@p` will be replaced
// or @i for internal
instance. at i
__________________
|[M] Void boo() |
|[V] String string |
|__________________|
Something like this would be handy.
--
Adrian Zubarev
Sent with Airmail
Am 1. Juni 2016 um 18:23:46, Tino Heth (2th at gmx.de) schrieb:
I never liked the underscores (so for me, they have been the best choice to mark stuff I should not know of in Cocoa ;-).
For several years, I prefixed instance variables with "m", but stopped doing so after a talk about bad habits in writing Java code:
It is like Hungarian notation, which also puts redundant information into names — and if even Java-folks think it's anachronistic… ;-)
Objective-C lacked some features that Swift has, so workarounds had been created; but those shouldn't be carried over (by the way: It's similar with file names and those extensions, and a modern file system for OS X is years overdue ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160601/95f61d65/attachment.html>
More information about the swift-users
mailing list