Xcode 6 Beta 4: Swift has access controls
July 21, 2014
Only 2 weeks after the previous beta release, we get the next iteration of Xcode and iOS. Here are some key features:
- ACCESS CONTROLS! I believe developers would have been outraged if Swift did not include this soon. While still in Beta, Swift does implement the important programming paradigm of access controls although it is done in a slightly different way, as to be expected. The basic description from Apples release notes is as follows:
privateentities can only be accessed from within the source file where they are defined.
internalentities can be accessed anywhere within the target where they are defined.
publicentities can be accessed from anywhere within the target and from any other context that imports the current target’s module.
Another nice one is the keywords
@requiredare drifting away from any Objective-C roots they had by making the @ sign not required. So you would just say
lazy, for example.
Another nice, almost superficial improvement is Xcode now recognizes comment annotations for the following:
//FIXME:. It will also include them in the jump bar so you can “jump” right to that point in code. This is nice to have since
#pragma marksseem to have disappeared in Swift. Some at Apple believe using extensions would make more sense rather than throwing pragma marks everywhere, but I guess that is up to you 😃
- From what I can tell, the left pane in Xcode has been improved, there is not overlapping icons, which is great. Also, Xcode projects seems to have gotten a more Yosemite UI update. A+ for small UI changes.
- Lastly, I never used
.by()functions, but their replacement of
stride()functions looks straightforward and readable, kind of like those verbose Objective-C method signatures. Take a look at the examples in the Apple Release notes:
stride(from: x, to: y, by: z) // was: (x..<y).by(z) stride(from: x, through: y, by: z) // was: (x...y).by(z)
What I want to see
- An improved debugger console, most of the time I cannot see the values of elements where I have set a breakpoint. I then revert back to beginner programming days of putting print statements everywhere… I am going to have to play with Beta 4 a little more to see if there are any improvements on this.
It is so cool to be developing in a new programming language as it is being created! All the big and important programming languages we know about have been out of Beta forever, but Swift is just getting started.Tweet