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
Swiftをキめると 気持ちいい!
Search
Takaaki Tanaka
July 26, 2016
Technology
0
1.2k
Swiftをキめると 気持ちいい!
AKIBAswift #04での資料です
Takaaki Tanaka
July 26, 2016
Tweet
Share
More Decks by Takaaki Tanaka
See All by Takaaki Tanaka
Zenn のウラガワ ~エンジニアのアウトプットを支える環境で Google Cloud が採用されているワケ~ #burikaigi #burikaigi_h
kongmingstrap
22
8.2k
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
270
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
980
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
760
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
620
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
670
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.9k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
300
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
1
1.5k
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.6k
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
260
AIドリブンのソフトウェア開発 - うまいやり方とまずいやり方
okdt
PRO
9
550
GCASアップデート(202506-202508)
techniczna
0
240
つくって納得、つかって実感! 大規模言語モデルことはじめ
recruitengineers
PRO
12
2.7k
Goでマークダウンの独自記法を実装する
lag129
0
210
LLMエージェント時代に適応した開発フロー
hiragram
1
390
あとはAIに任せて人間は自由に生きる
kentaro
3
1.1k
GitHub Copilot coding agent を推したい / AIDD Nagoya #1
tnir
2
4.4k
第4回 関東Kaggler会 [Training LLMs with Limited VRAM]
tascj
11
1.6k
[OCI Skill Mapping] AWSユーザーのためのOCI(2025年8月20日開催)
oracle4engineer
PRO
2
130
イオン店舗一覧ページのパフォーマンスチューニング事例 / Performance tuning example for AEON store list page
aeonpeople
1
220
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.6k
Become a Pro
speakerdeck
PRO
29
5.5k
A better future with KSS
kneath
239
17k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
20k
Practical Orchestrator
shlominoach
190
11k
Code Review Best Practice
trishagee
70
19k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Transcript
4XJGUΛΩΊΔͱ ؾ͍͍࣋ͪʂ AKIBA.swift #04
About Me • ాத ໌ (Takaaki Tanaka) • Ϋϥεϝιουגࣜձࣾ •
@kongmingtrap • iOS Developer (Swift / Objective-C) • GyazSquare / GitHub
օ༷
4XJGUॻ͍͍ͯ·͔͢ʁ
0CKFDUJWF$͔Βೖ͖ͬͯͨํʑ
πϥ͘ͳ͍Ͱ͔͢ʁ
πϥ͔ͬͨͰ͢ɻ
ͦΕ͔Βɻɻɻ৭ʑ͋Γɻɻɻ
ศརͳؔΛͬͯ ؆ܿʹॻ͘Α͏ʹ͢Δ͜ͱͰ ॻ͘ͷָ͕͘͠ͳ͖ͬͯ·ͨ͠ɻ
ศརͳؔ w GPS&BDI w NBQ w SFEVDF w pMUFS w
qBUNBQ
ศརͳؔ w GPS&BDI w NBQ w SFEVDF w pMUFS w
qBUNBQ
NBQqBUNBQ w 0QUJPOBM w 4FRVFODF5ZQF w $PMMFDUJPO w 'MBU.BQ ద༻͞Ε͍ͯΔऀͨͪ
NBQqBUNBQ public func map<U>( _ transform: @noescape (Wrapped) throws ->
U ) rethrows -> U? { switch self { case .some(let y): return .some(try transform(y)) case .none: return .none } }
ࡉ͔͍આ໌ল͍ͯޙʹͯͬͯ͠ΈΑ͏
NBQqBU.BQͰ ಈ࡞ΛൺͯΈΔ
&YBNQMF enum PokemonType: String { case Grass = "Grass" case
Water = "Water" case Fire = "Fire" case Electric = "Electric" } ͋Δ࣌͜Μͳ&OVN͕͓Γ·ͨ͠ɻ
4FRVFODF let types = ["Grass", "Water", "Fire", "Electric"] let pokemonTypes
= types.map { PokemonType(rawValue: $0) } [Optional PokemonType.Grass Optional PokemonType.Water Optional PokemonType.Fire Optional PokemonType.Electric ] ݁Ռ͕0QUJPOBMʹͳΔ
4FRVFODF let types = ["Grass", "Water", "Fire", "Electric"] let pokemonTypes
= types.flatMap { PokemonType(rawValue: $0) } [PokemonType.Grass PokemonType.Water PokemonType.Fire PokemonType.Electric] ݁Ռ͕VOXSBQ͞ΕΔ
4FRVFODF let types = ["Grass", "Water", "Fire", "Ice"] let pokemonTypes
= types.map { PokemonType(rawValue: $0) } [Optional PokemonType.Grass Optional PokemonType.Water Optional PokemonType.Fire nil] ۪ʹ݁ՌΛฦ͢
4FRVFODF let types = ["Grass", "Water", "Fire", "Ice"] let pokemonTypes
= types.flatMap { PokemonType(rawValue: $0) } [PokemonType.Grass PokemonType.Water PokemonType.Fire] ݁Ռ͕VOXSBQ͞ΕɺOJM͕ଧͪফ͞ΕΔ
$PMMFDUJPO let types1 = ["Electric", "Electric", "Fire"] let types2 =
["Water", "Ice"] let types3 = ["Fire", "Grass", "Rock", "Grass"] let types = [types1, types2, types3].map { $0 } [["Electric", "Electric", "Fire"], ["Water", "Ice"], ["Fire", "Grass", "Rock", "Grass"]]
$PMMFDUJPO let types1 = ["Electric", "Electric", "Fire"] let types2 =
["Water", "Ice"] let types3 = ["Fire", "Grass", "Rock", "Grass"] let types = [types1, types2, types3].flatMap { $0 } ["Electric", "Electric", "Fire", "Water", "Ice", "Fire", "Grass", "Rock", "Grass"] ݁Ռ͕qBUͳ"SSBZʹͳΔ
$PMMFDUJPO let types1 = ["Electric", "Electric", "Fire"] let types2 =
["Water", "Ice"] let types3 = ["Fire", "Grass", "Rock", "Grass"] let types = [types1, types2, types3].flatMap { $0 }.flatMap { PokemonType(rawValue: $0) } [PokemonType.Electric PokemonType.Electric PokemonType.Fire PokemonType.Water PokemonType.Fire PokemonType.Grass PokemonType.Grass] OJM͕ଧͪফ͞ΕΔͨΊɺཉ͍͠σʔλ͚ͩΔ
0QUJPOBM let value: String? = "Fire" let value1 = value.map
{ PokemonType(rawValue: $0) } Optional Optional PokemonType.Fire ݁Ռ͕ೋॏͷ0QUJPOBMʹͳΔ
0QUJPOBM let value: String? = "Fire" let value1 = value.flatMap
{ PokemonType(rawValue: $0) } Optional PokemonType.Fire ݁Ռͷ0QUJPOBM͕ଧͪফ͞ΕΔʢVOXSBQ͞ΕΔʣ
0QUJPOBM let type = PokemonType(rawValue: "Water") let changedType = pokemon.map
{ type -> PokemonType in switch type { case .Water: return PokemonType.Electric default: return type } } Optional PokemonType.Electric VOXSBQͯ͠ΛऔΓѻ͏
0QUJPOBM let value1: Int? = 10 let value2: Int? =
20 let value = value1.flatMap { v1 in value2.map { v2 in v1 + v2 } } Optional 30 0QUJPOBMಉ࢜ͷͷܭࢉ
·ͱΊ w ؆ܿʹॻ͜͏ w 0QUJPOBMͱྑ͖͘߹͓͏ w 1MBZHSPVOEΛ༗ޮ׆༻͠Α͏
5IBOL:PV