cs193p – Smashtag Update Swift 1.2

By Amada44 (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons

Please note, this blog entry is from a previous course. You might want to check out the current one.

To run the Smashtag code with Swift 1.2. are quite extensive:

  • countElements() is now called count()
  • as needs to be replaced with as!
  • reduce() requires the combine parameter named explicitly
  • same with custom methods, its now quite strict …
  • let is now more restrictive, some parameters have to be changed to var (it might be I went a little bit over board here)
  • NSString is no String any more and needs to be cast explicitly
  • if a parameter is set within a closure of the init method, set a default value outside

The updated code is available on GitHub.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

One thought on “cs193p – Smashtag Update Swift 1.2”

Leave a Reply

Your email address will not be published.