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
Fizz Buzz問題で(ちょっと) わかる気がするSwift
Search
itaru
December 09, 2019
Programming
0
420
Fizz Buzz問題で(ちょっと) わかる気がするSwift
Fukuoka.LT
福岡のいろんなコミュニティを集められるだけ集めて合同忘年LT大会
itaru
December 09, 2019
Tweet
Share
More Decks by itaru
See All by itaru
Swiftでswizzling
itaru0724
0
420
Other Decks in Programming
See All in Programming
Click-free releases & the making of a CLI app
oheyadam
2
120
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
Jakarta EE meets AI
ivargrimstad
0
200
CSC509 Lecture 11
javiergs
PRO
0
180
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
CSC509 Lecture 09
javiergs
PRO
0
140
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
Jakarta EE meets AI
ivargrimstad
0
580
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
役立つログに取り組もう
irof
28
9.6k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Into the Great Unknown - MozCon
thekraken
32
1.5k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Transcript
Fukuoka.LT Ԭͷ͍ΖΜͳίϛϡχςΟΛूΊΒΕΔ͚ͩूΊͯ߹ಉLTେձ HAKATA.swift ͍ͨΔ Fizz BuzzͰ (ͪΐͬͱ) Θ͔Δؾ͕͢ΔSwift
ࠂ
Swift Days Fukuoka 1݄24(ۚ)~26()
ͳʹͦΕʁ
Swift iOS ίϛϡχςΟ ߹ಉษڧձ
5ίϛϡχςΟ ࢀՃ
HAKATA Test Night
HAKATA TEST NIGHT
Swift ෮शձ
Swift Ѫձ
Mr.סഋʔࣣౡ͞Μ
Θ͍Θ͍swiftc
1݄24(ۚ)~26()
1݄24(ۚ)~26()
ॴ
͜͜ LINE Fukuoka
͝ࢀՃ͍ͩ͘͞
͞Βʹ
None
try! Swift 2020 Tokyo
try! Swift 2020 Tokyo
ࣗݾհ
͗͢ͱ ͍ͨΔ @itaru_sugimoto ͍ͨΔΜ Money Forward, Inc. υϧϮλ ίϯΧϑΣ
ͬͱຊฤ
Fizz BuzzͰ (ͪΐͬͱ) Θ͔Δؾ͕͢ΔSwift
None
FizzBuzz?
3ͰׂΓΕΔ߹ʮFizzʯ 5ͰׂΓΕΔ߹ʮBuzzʯ ྆ऀͰׂΓΕΔ߹ʢ͢ͳΘͪ15 ͰׂΓΕΔ߹ʣʮFizz Buzzʯ Λग़ྗ FizzBuzz ࢀߟ:https://ja.wikipedia.org/wiki/Fizz_Buzz
͍ͨΔΜ FizzBuzz ͬͯΈͨ
ॳڃฤ
None
let Ͱએݴ͞Εͨม ॻ͖ࠐΊΔͷ1͚ͩ
CountableClosedRangeܕ ͷൣғࢦఆ
Ҿ໊ͷলུ // value inলུ
தڃฤ
None
map Ͱ֤ཁૉʹରͯ͠FizzBuzzͷఆΛߦ͍ ݁ՌΛStringͰฦ͢
reduce ɺྻͷ݁ՌΛ݁߹Ͱ͖Δ
Computed Properties ฤ
ܾ·ͬͨΛอ͓࣋ͯ͠ΒͣϓϩύςΟ͕ ݺͼग़͞ΕΔʹܭࢉ͞ΕͯΛऔಘͰ͖Δ
Tuple ฤ
ෳͷܕ͔ΒҰͭͷܕΛ࡞Δ͜ͱ͕Ͱ͖Δ ҟͳΔܕΛ·ͱΊΒΕΔͷ͕ྻͱҟͳΔ
ऴΘΓ
Summary • Property ͍ํ৭ʑʂʂ • map tuple , enum
ͳͲศརͳੑ࣭͕͍ͬͺ͍ʂ • ଞʹ compactMap, flatMap ʂʂ • SwiftyͱԿ͔ʁʁʁ • ͬͱΓ͍ͨͱࢥͬͨํɾɾɾ
Swift Days Fukuoka 1݄24(ۚ)~26()
͝ࢀՃ͍ͩ͘͞
Thank you