Xcode 6 beta 5 update

With release of Xcode 6 beta 5, cat and mouse game continues: virtually every open source project/library written in Swift, needs to be updated. Not complaining at all, let’s see what I needed to update in example Actor library project and what is probably waiting for you to encounter.

LogicValue is now BooleanType

Swift engineers are willing to make naming consistent, and all built-in protocols shall be called something-able, -ible or -Type. If you happen to have implemented LogicValue somewhere:

  1. Rename it to BooleanType
  2. Remove getLogicValue() -> Bool function, moving its body to:

New BooleanType protocol defines not a function, as it was in LogicValue, but required property. Now we have a bit of extra consistency.

Optionals are no longer LogicValue (nor BooleanType)

To prevent ambiguous constructs, you can no longer use Optional value in if statement, now it needs to be explicitly compared with nil. I have used it in my functional extension to Optional, which I wrote about, and which has been rendered almost useless with Beta 5.

Elvis operator

Short ?? (two question marks) operator does the same as Optional+getOrElse() extension.

Converting String to C String

Apparently String.bridgeToObjectiveC() is gone, and I needed to find other way of converting Swift’s Strings to C Strings. Existing code which creates serial dispatch queue:

Now is replaced by cleaner code:

Required keyword in initializers

Any subclass inheriting required initializer need to place ‘required’ keyword in front of each required initializer.

This concludes my opinionated, subjective list of breaking changes of Beta 5. I hope the more obscure ones will be found helpful!


Leave a Reply

Your email address will not be published. Required fields are marked *