Skip to content

Instantly share code, notes, and snippets.

@miwillhite
Last active August 29, 2015 14:07
Show Gist options
  • Save miwillhite/75e4ad7af09aaa8819da to your computer and use it in GitHub Desktop.
Save miwillhite/75e4ad7af09aaa8819da to your computer and use it in GitHub Desktop.
Gettin Switty Wit It

UIButton

Button handlers cannot be private

For-in

Cast the collection (which also casts the item) by appending as Type

for annotation in selectedAnnotations as [MKAnnotation] {
  view.deselectAnnotation(annotation, animated: false)
}

i18n

Interprolated strings won't parse correctly when exporting for localization. Instead use String.localizedStringWithFormat() passing in the NSLocalizedString as the first argument.

Things to remember:
  • Remember to configure the scheme for the language you want to test, just updating the device isn't enough.
  • Clean the project if not everything is coming through.
  • The Localizable.strings portion of the .xliff document needs to have the <target> node added to it.

Interoperability with Obj C

If you have an error in your Swift code the *-Swift.h header will not build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment