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
How to read Swift
Search
Yusuke Hosonuma
February 14, 2015
Programming
320
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to read Swift
声に出して読みたいSwift
Yusuke Hosonuma
February 14, 2015
More Decks by Yusuke Hosonuma
See All by Yusuke Hosonuma
KotlinTest で始める Property-based Testing/kotlintest-property-based-testing
yusukehosonuma
2
1.6k
Marzipan の正体は何だったのか そして SwiftUI の衝撃/wwdc19_marzipan_swiftui
yusukehosonuma
2
1k
標準パッケージにおけるテストでの利用例から学ぶ testing / quick パッケージ/golang-testing-quick
yusukehosonuma
4
12k
Swift で ParameterizedTest をやってみた話/swift-parameterized-test
yusukehosonuma
4
2.3k
Property-based test beginning with SwiftCheck
yusukehosonuma
1
6.3k
XCTest(再)入門/reintroduction-to-xctest
yusukehosonuma
0
670
ソースコードから読み解く - Quick はどのように実装されているのか?/quick-code-reading
yusukehosonuma
7
11k
Swift 4.2 はどのような進化をしているのか/whats-new-swift42
yusukehosonuma
16
15k
HTTPモックライブラリ「Mockingjay」を使ってみた話/swift-mockingjay
yusukehosonuma
5
4.4k
Other Decks in Programming
See All in Programming
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
460
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
ActionController meets Protocol Buffers
sorah
0
520
sbt 2.0: takeoff
eed3si9n
0
160
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
カツオ、ご期待ください
suneo3476
0
190
ジョジョの世界をXRで再現する
mofurune
0
160
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
310
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
330
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Making the Leap to Tech Lead
cromwellryan
135
10k
How to build a perfect <img>
jonoalderson
1
6.1k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
Thoughts on Productivity
jonyablonski
76
5.4k
WENDY [Excerpt]
tessaabrams
14
40k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Statistics for Hackers
jakevdp
799
230k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Transcript
SwiftͷಡΈํ ʹग़ͯ͠ಡΈ͍ͨSwift
ࣗݾհ • Yusuke Hosonuma • ͖ͳݴޠɿJavaɺScalaɺSwiftʁ • Qiitaɿqiita.com/YusukeHosonuma • झຯɿΞχϝͱ͔ݟ·͢ɻ߈֪ػಈୂͱ͔ɻ
ࠓͷςʔϚ
Swiftͬͯ ຊʹಡΈ͍͢ʁ
ຊʹʁ var name: String? var name: String! var name: String
= userName ?? "Guest" func sum(number1 a:Int, number2 b:Int) -> Int { return a + b } fruits.sort({ (s1: String, s2: String) -> Bool in return s1 < s2 }) func say(greet: String) -> (String -> String) { func greet(name: String) -> String { return "\(greet), \(name)!" } return greet }
׳ΕΔ·Ͱਏ͍ ʢݸਓͷײͰ͢ʣ
ͦΕͳΒ ʹग़ͯ͠ಡΜͰΈΑ͏ʂ
ʹग़ͯ͠ಡΈ͍ͨ Swiftʢ͢͏͌;ͱʣ
Lesson1: ม var name: String
Lesson1: ͜͏ಡΈ·͢ var name: String ᶃม ᶄname ᶅStringܕͰఆٛ͞ΕΔ ৭ΜͳॴͰΘΕΔ جຊܗʂ
Lesson2: Optional var name: String?
Lesson2: ͜͏ಡΈ·͢ var name: String? ᶃม ᶄname ᶅStringܕ ᶆͷOptionalܕͰఆٛ͞ΕΔ
Lesson3: ڧ੍Ξϯϥοϓܕ var name: String!
Lesson3: ͜͏ಡΈ·͢ var name: String! ᶃม ᶄname ᶅStringܕ ᶆͷOptionalܕ ᶇ͚ͩͲʂ
ڧ੍తʹUnwrap͞ΕΔʂʂ
Lesson4: Nil Coalescing Operator var name: String = userName ??
"Guest"
Lesson4: ͜͏ಡΈ·͢ var name: String = userName ?? "Guest" ᶃมnameʹ
ᶄuserNameʹ͕ೖͬͯͨΒ ᶅͦͷத ᶆೖͬͯͳ͚Ε͜Ε ᶇΛೖ͢Δ
Lesson5: ϝιου func sayHello(name s:String) -> String { return “Hello,
\(s)!” } sayHello(name: "Yusuke")
Lesson5: ͜͏ಡΈ·͢ func sayHello(name s:String) -> String { return “Hello,
\(s)!” } sayHello(name: "Yusuke") ᶃϝιου ᶅStringܕͰఆٛ͞Εͨ ᶄsayHello ᶆsͱ͍͏ҾΛड͚औΓ ᶇStringܕͷ݁ՌΛฦ͢ ᶈͪͳΈʹݺͼग़͢ͱ͖ʹ nameͰࢦఆͯ͠Β͏
Lesson6: Ϋϩʔδϟ fruits.sort({ (s1: String, s2: String) -> Bool in
return s1 < s2 })
Lesson6: ͜͏ಡΈ·͢ fruits.sort({ (s1: String, s2: String) -> Bool in
return s1 < s2 }) ᶃsortʹ༩͑ΔΫϩʔδϟ{} ᶄStringܕͷ(s1, s2)ΛҾʹड͚औΓ ᶅBoolܕΛฦ͢ ᶆͦͯ͠ ᶇ࣮ࡍͷॲཧ͜͏ͳΔ
॓: ؔΛฦؔ͢ func say(greet: String) -> (String -> String) {
func greet(name: String) -> String { return "\(greet), \(name)!" } return greet } let sayHello = say("Hello") sayHello(name: "Hosonuma") sayHello(name: "Yusuke")
5ճ͘Β͍ʹग़ͯ͠ ಡΜͰΈΕ
͖ͬͱ͋ͳͨSwift͕ ͖ʹͳͬͯ͘Δͣʂ
Let’s say Swift.
͝੩ௌ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ɻ