Update code for changes in swift

This commit updates the code generated to follow the new syntax rules of
Swift.

You can no longer "not" (!) an optional to use it as a conditional, so
some code had to be updated to check for the absence of `nil` as opposed
to its presence.