[swift-evolution] Partial class declaration
Andrey Volodin
siddok at gmail.com
Sat Dec 10 15:48:31 CST 2016
There is a lot of talk about stored properties in extensions. But do we really need them?
Instead I think we can introduce something like partial classes from C#. It is an often case our classes go hell of a big and we have to move some methods to dedicated extensions to increase readability. It is also an often case that those methods have some stored properties they work with. This is often leads to a pattern where we have all stored properties declared in Class.swift and then we implement extensions in Class+Something.swift files.
I bet partial classes should only be available within one module, so you can’t extend class from library, etc and work close to text-wide level, just to ease the code navigation. That is also will allow some code generation tricks, making it easy to create UI/Level designers for Swift. (for example you can generate some methods and properties of a Scene class in an editor and mix-in that in the user’s project.)
Any thoughts?
More information about the swift-evolution
mailing list