Swift Around the Web

This week's must-reads include great summaries of XCode 6 Beta 6 changes, examples of how to use Swift functions and arrays, and of course I had to throw in a Swift JSON parsing with functional programming blog post in there :)






Apple News

Beta 6 is out!!!!!!! What stood out from this release is that changes included a lot more bug fixes / optimizations versus the major changes we've been seeing in the Swift language between betas until now (like re-writing how Swift arrays work!).

Don't get me wrong though, these bug fixes / optimizations are definitely major. I've been feeling the pain of this one in my Swift projects:

A large number of Foundation APIs have been audited for optional conformance, removing a significant number of implicitly unwrapped optionals from their interfaces. This clarifies the nullability of their properties and arguments / return values of their methods. This is an ongoing effort since beta 5.

Another thing to note is that there was no new iOS8 beta released. Does that mean Apple is getting ready to do an official release next? I don't know!

Here are the Beta 6 goodies:

Oh, and don't miss these great blog post from the Swift Blog!

Random Cool Stuff

Ok, so maybe I'm late to the game, but did you know that Command + Control + Space brings up the emoji keyboard on your mac?!! Now I can write some real Swift code, lol. Special thanks @tammofreese for helping me figure it out!

In Case You Missed It

I have many blog posts lined up that I haven't had a chance to write just yet due to travel this week. However, I'm glad the one blog post I did have time to write was about Swift Debugging. I also just posted slides from my talk at GoModev about Swift Functions. Enjoy!

Swift Code

Wohoo!! Swift Playground Builder empowers you to create Apple-like playgrounds with your own fancy embedded documentation. In addition to the playground builder, this week's libraries are focused on extending Swift in fun ways. Love looking through the code in these libraries!

  • Swift Playground Builder - Create your own interactive Swift playgrounds with embedded documentation compiled from Markdown
  • Dollar.swift - A functional tool-belt for Swift Language similar to Lo-Dash or Underscore in Javascript
  • AFDateHelper - Convenience extension for NSDate in Swift
  • [ExSwift(https://github.com/pNre/ExSwift) - A set of Swift extensions for standard types and classes.
  • CryptoSwift - Bunch of crypto related functions for Swift

Swift ThoughtsSwift Thoughts

The most exciting Swift-y thing I did this week was figure out how to properly write Unit Tests in Swift. Yes, I'm one of those developers who gets excited about Unit Tests :) And yes, I'll make sure to blog about my experience and challenges working with the XCTest framework in Swift this upcoming week, so make sure to follow my blog (RSS feed available here).

The first big challenge to writing unit tests in Swift was access controls. Since unit tests are in a different target than the project code, the code you'd like to test either needs to be made public, or it needs to be added to the test target. Andrew Bancroft outlined these two options in his very helpful blog post: Swift Access Control – Implications for Unit Testing.

I'm guessing Apple will fix the access control issue in future releases, so I like the second option - adding my code to the test target. It's going to be much easier to remove files from the test target if needed than having to make variables and functions public individually just for testing purposes.

If you haven't looked into testing your iOS code yet, I highly recommend reading the latest issue of objc.io - Testing.

NatashaTheRobot