Swift Cheat Sheet and Quick Reference

Discussion of the official tutorials published on raywenderlich.com. Please only discuss the official tutorials here - for general questions, use the General Discussion forum instead.

Swift Cheat Sheet and Quick Reference

Postby rwenderlich » Tue Jun 03, 2014 5:25 am

This is the official thread to discuss the following blog post: Swift Cheat Sheet and Quick Reference
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Site Admin
 
Posts: 2512
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 36 times
Been thanked: 479 times

Postby Craimasjien » Tue Jun 03, 2014 9:38 am

Ray, thanks for the cheat sheet. One minor thing though. In the Swift book in the Classes chapter they explicitly tell you that they rather not use the term 'Object' for class instances, but rather the term 'Instance'. This is because of the fact that Swift Structures and Classes are VERY similar in form and function.
Thanks for the cheat sheet!
Craimasjien
n00b
 
Posts: 3
Joined: Sat Sep 21, 2013 8:39 pm
Has thanked: 0 time
Been thanked: 0 time

Postby Alarcon » Tue Jun 03, 2014 9:46 am

Cool!! Thanks!!
Maybe you can add in methods an example when you return multiple values, and in control flow, add the "...". 0..9 is different from 0...9.
Cheers!!
Alarcon
n00b
 
Posts: 2
Joined: Mon Feb 17, 2014 11:52 am
Has thanked: 0 time
Been thanked: 0 time

Postby rwenderlich » Tue Jun 03, 2014 9:56 am

@Craimasjien @Alarcon Thanks so much, updated! :]
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Site Admin
 
Posts: 2512
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 36 times
Been thanked: 479 times

Postby scotteg » Tue Jun 03, 2014 11:13 am

Great resource Ray, thanks! Here are some things to maybe add/mention...

1. Stored values should optimally be declared as constants (let vs. var) when their values will not change
2. Floating point numbers will be type-inferred as Double if not explicitly typed
3. _'s can be used to improve readability of long numbers, e.g., 1_000_000
4. Example of type conversion
5. Example of using Unicode characters for variable and constant names
6. Switches can support any kind of data
7. If conditionals must resolve to Boolean true or false
8. Example of returning a tuple
9. Comments can now be nested
10. Example of enum, e.g., including a func
11. Structs are always copied vs. classes are passed by reference
12. Example of type alias
13. Example of optionals
--
Scott Gardner
@scotteg
http://scotteg.com
User avatar
scotteg
Hacker
 
Posts: 27
Joined: Sun May 01, 2011 11:15 pm
Location: Greater St. Louis area
Has thanked: 9 times
Been thanked: 1 time

Postby Vardhan » Tue Jun 03, 2014 12:12 pm

Thanks it will be very useful cheat sheet :)
Vardhan
n00b
 
Posts: 1
Joined: Tue Jun 03, 2014 12:09 pm
Has thanked: 0 time
Been thanked: 0 time

Postby RobbyS » Tue Jun 03, 2014 12:54 pm

Thanks for the cheat sheet! Good post.
RobbyS
n00b
 
Posts: 1
Joined: Tue Jun 03, 2014 12:51 pm
Has thanked: 0 time
Been thanked: 0 time

Postby asmodeo » Tue Jun 03, 2014 12:57 pm

Thanks
asmodeo
Baby Hacker
 
Posts: 8
Joined: Mon Sep 09, 2013 9:57 pm
Has thanked: 0 time
Been thanked: 0 time

Postby GeekyEggo » Tue Jun 03, 2014 1:26 pm

This is really exciting news. Coming from a C# background, and having only dabbled very lightly in Objective-C creating a few native apps, this already feels like home!
GeekyEggo
n00b
 
Posts: 1
Joined: Tue Jun 03, 2014 1:25 pm
Has thanked: 0 time
Been thanked: 0 time

Postby AlexC » Tue Jun 03, 2014 1:31 pm

Great .. Thanks
AlexC
Hacker
 
Posts: 39
Joined: Thu May 01, 2014 1:05 pm
Has thanked: 2 times
Been thanked: 1 time

Next

Return to Official Tutorials

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests