Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
A Swift Introduction To Swift
Search
Neil Kimmett
August 22, 2016
Technology
0
99
A Swift Introduction To Swift
Given at Codebar August 2016
https://codebar.io/meetings/monthly-aug-2016
Neil Kimmett
August 22, 2016
Tweet
Share
More Decks by Neil Kimmett
See All by Neil Kimmett
Scaling your app's release process
neilkimmett
0
180
React Native in a native world
neilkimmett
0
210
React Native on tvOS
neilkimmett
0
1.9k
Contributing to Swift
neilkimmett
0
62
Contributing to Swift
neilkimmett
0
49
A Swift introduction
neilkimmett
0
140
Writing Swift
neilkimmett
0
300
Practical WatchKit
neilkimmett
0
290
So you want to make an Apple Watch app?
neilkimmett
0
150
Other Decks in Technology
See All in Technology
【shownet.conf_】ShowNet伝送改めShowNet APN 2024
shownet
PRO
0
440
DenoでもViteしたい!インポートパスのエイリアスを指定してラクラクアプリ開発
bengo4com
2
1.9k
Hazard pointers with reference counter
ennael
PRO
0
120
トークナイザー入門
payanotty
2
950
軽いノリで"自動化"に取り組んではいけないという話
tetsuyaooooo
1
490
ADRを運用して3年経った僕らの現在地
onk
PRO
12
5k
【shownet.conf_】革新と伝統を融合したファシリティ
shownet
PRO
0
330
Oracle Database 23ai 新機能#4 Real Application Clusters
oracle4engineer
PRO
0
150
Webセキュリティのあるきかた
akiym
31
9.8k
Oracle GoldenGate 23ai 導入Tips
oracle4engineer
PRO
1
270
「ばん・さく・つき・たー!」にならないためにSHIROBAKOから 学んだこと
ysknsid25
3
670
令和最新版 Perlコーディングガイド
anatofuz
4
3.6k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Designing for Performance
lara
604
68k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
1
280
How GitHub (no longer) Works
holman
311
140k
Web development in the modern age
philhawksworth
205
10k
What the flash - Photography Introduction
edds
67
11k
Making Projects Easy
brettharned
115
5.9k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
How to Ace a Technical Interview
jacobian
275
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.5k
Transcript
A Swift Introduction To Swift by @neilkimmett
Swift is a type safe language
Types Javascript "1" + 2 = "12" Ruby x =
5 x = "a string" x = Dog.new
Types Swift "1" + 2
Types Swift var x = 5 x = "a string"
Types let number: Int = 2 let name: String =
"Sup Codebar" let primes: [Int] = [2, 3, 5, 7, 11] let view: UIView = UIView() view.backgroundColor = UIColor.whiteColor()
✨ Type inference ✨ let number = 2 let name
= "Sup Codebar" let primes = [2, 3, 5, 7, 11] let view = UIView() view.backgroundColor = .whiteColor()
Constants & variables let words = "Hello, there" words =
"Bye for now"
Constants & variables let words = "Hello, there" words =
"Bye for now"
Constants & variables let words = "Hello, there" words =
"Bye for now"
Constants & variables var words = "Hello, there" words =
"Bye for now"
Functions func multiply(array: [Int], by: Int) -> [Int]
Functions func multiply(array: [Int], by: Int) -> [Int] { var
result = [Int]() for x in array { result.append(x * by) } return result }
Functions func multiply(array: [Int], by: Int) -> [Int] { return
array.map({ (x) -> Int in return x * by }) }
Functions func multiply(array: [Int], by: Int) -> [Int] { return
array.map { $0 * by } }
Functions func multiply(array: [Int], by: Int) -> [Int] { return
array.map { $0 * by } } multiply(array: numbers, by: 2)
Classes class Counter { private var count = 0 func
increment() { count += 1 } } let counter = Counter() counter.increment()
Optionals?!
Optionals class Codebar { var location: String = "Pivotal Labs,
EC1V 9NR" } let codebar = Codebar() // insert lots of awesome talks here codebar.location = "The pub" // insert lots of inspiring conversations here codebar.location = nil !
?
Optionals class Codebar { var location: String? = "Pivotal Labs,
EC1V 9NR" } let codebar = Codebar() // stuff codebar.location = nil !
Other super awesome stuff • structs • enums • protocols
• generics • frameworks
Further reading • "The Swift Programming Language" by Apple •
raywenderlich.com • swift.org • WWDC videos • IBM Swift Sandbox • Swift Playgrounds for iPad on iOS 10
Thanks ! @neilkimmett "
[email protected]
# kimmett.me