Download - Let's talk swift - an introduction
![Page 1: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/1.jpg)
Let’s Talk SWIFT 30 min / 30 slides
![Page 2: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/2.jpg)
Hej! Mig?
� linkedin.com/jacobhhansen
� IT-Minds siden 2011
� iOS siden 2012
1.
![Page 3: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/3.jpg)
Definition
“builds on the best of C and Objective-C”
“Swift has been years in the making.”
“a new language for the future of Apple software development.”
2.
![Page 4: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/4.jpg)
Definition
“builds on the best of C and Objective-C”
“Swift has been years in the making.”
“a new language for the future of Apple software development.”
2.
![Page 5: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/5.jpg)
Ny syntax! 3.
![Page 6: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/6.jpg)
Deklarer en variable � Variabler og konstanter
Var myInt : Int = 2
Let myString : String = “Hej”
� Strongly Typed
� Type Inference
� Og....Emojies
4.
![Page 7: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/7.jpg)
Funktioner 5.
![Page 8: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/8.jpg)
NSLog(@”Hej”);
Println(“Hej”)
NSLog(@”Hej %@”, navn);
Println(“Hej \(navn)”)
6. Print Variabler
![Page 9: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/9.jpg)
Standard Types � String
� Character
� Int (32 / 64 bits)
� Double / Float
� Bool
� Array
� Dictionary
7.
![Page 10: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/10.jpg)
Array / Dictionary � Has a type!
� Short Hand
� Shortest Hand
� Mutable / Immutable
8.
![Page 11: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/11.jpg)
Objective-C kompabilitet � Bridge Header filer
� Generated Header (#import “appname-swift.h”
9.
![Page 12: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/12.jpg)
Platform
� iOS7 + 8
� OS X Yosemite + Mavericks
10.
![Page 13: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/13.jpg)
PlayGrounds
11.
![Page 14: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/14.jpg)
PlayGrounds
11.
![Page 15: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/15.jpg)
PlayGrounds 11.
![Page 16: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/16.jpg)
PlayGrounds
11.
![Page 17: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/17.jpg)
PlayGrounds
11.
![Page 18: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/18.jpg)
Enum
12.
![Page 19: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/19.jpg)
Switch � Must be exhaustive
� Don’t falll through on its own
� Pattern Matching
13.
![Page 20: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/20.jpg)
Associated/Raw Values
14.
![Page 21: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/21.jpg)
Optionals � Alt kan være nil
15.
![Page 22: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/22.jpg)
Optional binding
16.
![Page 23: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/23.jpg)
Optional Chaining 17.
![Page 24: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/24.jpg)
Protocols � No optionals
� Er typer (Delegation)
� Blueprint
Metoder
Operatorer
Subscripts
Properties
18.
![Page 25: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/25.jpg)
Protocols 18.
![Page 26: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/26.jpg)
REPL � Read-Eval-Print-Loop
� Kør Scripts!
19.
![Page 27: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/27.jpg)
Closures � Fungerer som blocks / lambdas
� Global / Nested / Expressions
20.
![Page 28: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/28.jpg)
Tuple � Midlertidig datastruktur
21.
![Page 29: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/29.jpg)
Ranges � Shortcut!
22.
![Page 30: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/30.jpg)
Ranges � Shortcut!
22.
![Page 31: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/31.jpg)
Operators � Overload Operators (class / struct level)
� Custom operators
Infix / Prefix / Postfix
/, =, -, +, !, *, %, <, >, &, |, ^, or ~
23.
![Page 32: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/32.jpg)
Struct / Class
� Class er reference (heap)
� Struct er værdi (stack) + ingen nedarvning
24.
![Page 33: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/33.jpg)
No Header! � Show what it is
25.
![Page 34: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/34.jpg)
Init / Deinit � Alt skal initialiseres!
26.
![Page 35: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/35.jpg)
Init / Deinit � Alt skal initialiseres!
26.
![Page 36: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/36.jpg)
Init / Deinit � Alt skal initialiseres!
26.
![Page 37: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/37.jpg)
Init more
27.
![Page 38: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/38.jpg)
Generics
28.
![Page 39: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/39.jpg)
Generics
+Type Constraints
28.
![Page 40: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/40.jpg)
Og meget mere…
� Private / Public
� Property Observers
� Subscripts
� Extensions
29.
![Page 41: Let's talk swift - an introduction](https://reader034.vdocuments.net/reader034/viewer/2022051400/55388a18550346b04c8b479b/html5/thumbnails/41.jpg)
Lær Mere! � https://developer.apple.com/swift/
� The Swift Programming Language
� Using Swift with Cocoa and Objective-C
� WWDC14
30.