Swift Interface vs Implementation
Swift Interface vs Implementation
- Subject: Swift Interface vs Implementation
- From: Richard Charles <email@hidden>
- Date: Fri, 21 Nov 2014 18:08:09 -0700
In Xcode 6.1 command click on a native Swift function like print or assert and jump to the definition. This takes you to the interface for the function in what appears to be a machine generated “definition file”. There are no .swift files in the Xcode package documentation area. So for Apple’s native Swift functions the interface is presented in one place and the implementation is somewhere else.
So how is that supposed to work for my code? A header files forces you to separate the interface from the implementation. I always thought that was a good thing but apparently not. But then again it appears that Apple may not be eating its own dog food because the interface appears to be separate from the implementation for the native swift stuff they provide.
Also note that in the Xcode 6.1 native Swift “definition file” there are no access control levels. The file that is presented does not contain any of the keywords: public, internal, or private. So it appears Apple has separated the interface from the implementation for native Swift functions using some other technique.
Apple’s documentation states Swift is “designed to scale from “hello, world” to an entire operating system.” Well I really can’t see how Swift could scale to a large complex project with the interface and implementation residing in the same file. But then again maybe I have spent too much time in C and Objective-C.
Richard Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden