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.1k
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
250
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
920
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
730
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
610
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
650
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.9k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
290
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
1
1.5k
Other Decks in Technology
See All in Technology
KubeCon + CloudNativeCon Japan 2025 Recap
ren510dev
1
300
AIとともに進化するエンジニアリング / Engineering-Evolving-with-AI_final.pdf
lycorptech_jp
PRO
0
140
怖くない!はじめてのClaude Code
shinya337
0
300
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
26k
Connect 100+を支える技術
kanyamaguc
0
150
AI導入の理想と現実~コストと浸透〜
oprstchn
0
150
KubeCon + CloudNativeCon Japan 2025 Recap Opening & Choose Your Own Adventureシリーズまとめ
mmmatsuda
0
230
PHPでWebブラウザのレンダリングエンジンを実装する
dip_tech
PRO
0
220
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
180
Lambda Web Adapterについて自分なりに理解してみた
smt7174
5
140
整頓のジレンマとの戦い〜Tidy First?で振り返る事業とキャリアの歩み〜/Fighting the tidiness dilemma〜Business and Career Milestones Reflected on in Tidy First?〜
bitkey
0
400
事業成長の裏側:エンジニア組織と開発生産性の進化 / 20250703 Rinto Ikenoue
shift_evolve
PRO
1
450
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
53
7.7k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
720
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
The Invisible Side of Design
smashingmag
300
51k
How to train your dragon (web standard)
notwaldorf
94
6.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
230
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