Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A Swift Introduction To Swift
Search
Neil Kimmett
August 22, 2016
Technology
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A Swift Introduction To Swift
Given at Codebar August 2016
https://codebar.io/meetings/monthly-aug-2016
Neil Kimmett
August 22, 2016
Transcript
24 slides
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
More Decks by Neil Kimmett
See All by Neil Kimmett
Scaling your app's release process
neilkimmett
0
310
React Native in a native world
neilkimmett
0
290
React Native on tvOS
neilkimmett
0
2.2k
Contributing to Swift
neilkimmett
0
87
Contributing to Swift
neilkimmett
0
73
A Swift introduction
neilkimmett
0
180
Writing Swift
neilkimmett
0
380
Practical WatchKit
neilkimmett
0
350
So you want to make an Apple Watch app?
neilkimmett
0
200
Other Decks in Technology
See All in Technology
人の努力に頼らないセキュリティをエンジニアリングする在り方 / An approach to engineering security that does not rely on human effort
carta_engineering
0
250
AWS Blocksで AIエージェント作れるの知ってます?
kmiya84377
1
170
メール到達性を支える、リンク先URLのドメイン評価の扱い方
wind111
0
200
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
510
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
340
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
4
890
Test Impact Analysis を武器に立ち向かう、AI 時代のテスト増加に対するヌーラボのアプローチ / getting-started-datadog-test-impact-analysis
k6s4i53rx
3
880
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
210
Kiro Enterprise Management: 管理者が 1 か所で決め、全員の Kiro に届ける
inariku
PRO
0
110
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
280
実測データからサービスの成長余力を測る。負荷シナリオ・テストデータ・限界値の設計
kazatohiei
1
180
サーバーラックは作る時代! 3Dプリンターで作る10インチラックのススメ
jacopen
2
520
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
1.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
310
New Earth Scene 8
popppiees
5
2.9k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
690
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
490
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Cost Of JavaScript in 2023
addyosmani
56
10k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
750