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