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.1k
Swiftをキめると 気持ちいい!
AKIBAswift #04での資料です
Takaaki Tanaka
July 26, 2016
Tweet
Share
More Decks by Takaaki Tanaka
See All by Takaaki Tanaka
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
160
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
690
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
630
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
520
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
570
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.6k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
230
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
0
1.4k
CPUブーストの話
kongmingstrap
0
69
Other Decks in Technology
See All in Technology
ヤプリQA課題の見える化
gu3
0
160
20240513 - 框裡框外_文學院學生如何在AI世代安身立命 @ 淡江大學
dpys
0
640
プロダクト組織で取り組むアドベントカレンダー/Advent Calendar in Product Teams
mixplace
0
680
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
120
When Windows Meets Kubernetes…
pichuang
0
270
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
1
190
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.1k
【令和最新版】ロボットシミュレータ Genesis x ROS 2で始める快適AIロボット開発
hakuturu583
2
1.5k
エンジニアリングマネージャー視点での、自律的なスケーリングを実現するFASTという選択肢 / RSGT2025
yoshikiiida
4
3.3k
RubyでKubernetesプログラミング
sat
PRO
2
120
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
480
最近のSfM手法まとめ - COLMAP / GLOMAPを中心に -
kwchrk
8
1.8k
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
For a Future-Friendly Web
brad_frost
176
9.5k
Side Projects
sachag
452
42k
The Invisible Side of Design
smashingmag
299
50k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
860
How to Think Like a Performance Engineer
csswizardry
22
1.3k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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