Extensions

I am a big fan of extensions, but I wonder what would happen years from now when we start to have lots of extensions created for the primitive classes. The problem is that we can write a String extension for example in any swift file in the project, the name of the file has nothing to do with the content of it. But for extensions … I think it is more ordered if we can see all Int extensions for example in same file. I don’t know how this could be done, maybe there is a way to even copy paste it automatically in a single file but for easier access I guess it would be nice to be able to find all extensions of a class in one place. You might not restrict it for anyone to write it in that single file, but you could automatically create a file for each class just to group all extensions of a class. Is that possible ?

I don't know how hard that'd be, but it sounds like a really neat feature for that new layer that Xcode's using to integrate with the compiler!

- Dave Sweeris

···

On Jul 31, 2017, at 4:19 PM, Omar Charif via swift-evolution <swift-evolution@swift.org> wrote:

I am a big fan of extensions, but I wonder what would happen years from now when we start to have lots of extensions created for the primitive classes. The problem is that we can write a String extension for example in any swift file in the project, the name of the file has nothing to do with the content of it. But for extensions … I think it is more ordered if we can see all Int extensions for example in same file. I don’t know how this could be done, maybe there is a way to even copy paste it automatically in a single file but for easier access I guess it would be nice to be able to find all extensions of a class in one place. You might not restrict it for anyone to write it in that single file, but you could automatically create a file for each class just to group all extensions of a class. Is that possible ?

Terms of Service

Privacy Policy

Cookie Policy