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
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yuka Ezura
August 20, 2016
Technology
6
4.2k
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
iosdc での発表資料です
Yuka Ezura
August 20, 2016
Tweet
Share
More Decks by Yuka Ezura
See All by Yuka Ezura
Mastering share sheet preview
ezura
4
1.4k
SF Symbols
ezura
9
1.4k
気遣いの iOS プログラミング
ezura
11
3.7k
Secret Swift tour
ezura
7
3k
Swift Album ver.4.1
ezura
3
1.5k
Swift と Kotlin
ezura
4
2.9k
哲学とSwiftの発表
ezura
5
620
アプリが動いたその先へ (iOS アプリ開発編)
ezura
1
1.1k
Blending Kotlin's culture into Swift
ezura
1
1.3k
Other Decks in Technology
See All in Technology
Kubecon NA 2025: DRA 関連の Recap と社内 GPU 基盤での課題
kevin_namba
0
110
Vitest Highlights in Angular
rainerhahnekamp
0
130
Azure SRE Agent x PagerDutyによる近未来インシデント対応への期待 / The Future of Incident Response: Azure SRE Agent x PagerDuty
aeonpeople
0
270
M&A 後の統合をどう進めるか ─ ナレッジワーク × Poetics が実践した組織とシステムの融合
kworkdev
PRO
1
280
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
2
480
ZOZOにおけるAI活用の現在 ~開発組織全体での取り組みと試行錯誤~
zozotech
PRO
4
3k
20260129_CB_Kansai
takuyay0ne
1
260
今日から始めるAmazon Bedrock AgentCore
har1101
4
320
みんなだいすきALB、NLBの 仕組みから最新機能まで総おさらい / Mastering ALB & NLB: Internal Mechanics and Latest Innovations
kaminashi
0
200
日本語テキストと音楽の対照学習の技術とその応用
lycorptech_jp
PRO
1
400
DEVCON 14 Report at AAMSX RU65: V9968, MSX0tab5, MSXDIY etc
mcd500
0
240
MySQLのJSON機能の活用術
ikomachi226
0
130
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.8k
Code Reviewing Like a Champion
maltzj
527
40k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Getting science done with accelerated Python computing platforms
jacobtomlinson
1
110
Building Adaptive Systems
keathley
44
2.9k
Navigating Team Friction
lara
192
16k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
Designing Powerful Visuals for Engaging Learning
tmiket
0
210
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
160
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
430
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
Transcript
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_ 2016/8/20 ezura
FSSPS͜ṽͫ͟͝Ħ
XBSOJOH͜ṽͫ͟͝Ħ
None
None
None
Δͩ͘ͼΛj
Δ͵ͺ᪇͡ ཱͺᲇձ͖ͱ͝͵ͱj
ဒᘥ ࣮ḝ ᙉණ
͟ΝĈ ᦉᷯΔ͔Ν
࣮ḝ᧸ͽុΜΤ᧬ͺԫᓸ ᓸͣΑΐͩΙ͘
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_
↟1IBOUPN5ZQF ↟%FDMBSBUJPO"UUSJCVUFT
$BTF
class HogeOperation { /// Ұ͚ͩݺͿ͜ͱ func prepare() /// prepare ޙ͔Β͑Δ
func execute() /// ͍ͭݺΜͰྑ͍ func mob() }
/// Ұ͚ͩݺͿ͜ͱ /// prepare ޙ͔Β͑Δ
private var isPrepared = false /// Ұ͚ͩݺͿ͜ͱ func prepare() {
guard !isPrepared else { fatalError("prepare() Λෳݺͳ͍͜ͱ") } isPrepared = true }
None
None
όλΩϸͩΚ͘Ĉ
1IBOUPN5ZQF ܕใΛར༻ͯ͠ॲཧͷޡΓΛࢦఠՄೳʹ
ᴰᨷঢ়ỪΑ ᑿᠭ൱ၙͼϦςψώΤᨷᤅ
protocol OperationState {} class Init: OperationState {} class Prepared: OperationState
{}
class HogeOperation<State: OperationState> {}
extension HogeOperation where State: Init { /// Ұ͚ͩݺͿ͜ͱ func prepared()
-> HogeOperation<Prepared> { let readyOp = HogeOperation<Prepared>() // TODO: ඞཁͳσʔλΛҾ͖ܧ͗ return readyOp } }
θϸϖΩϰέϮ⑲ ỹ ỹ
None
extension HogeOperation where State: Prepared { /// prepare ΛݺΜͩޙ͔Β༻Մೳ func
execute() { /* do somethig */ } }
θϸϖΩϰέϮ⑲
ଓ͟8FC https://gist.github.com/ezura/ f5aebef7bb86edbfd40b0bd1d0435e00
1IBOUPN5ZQF͖Ο͖Ο ↟ 'VODUJPOBM4OJQQFU1IBOUPN5ZQFT ↟ 4XJGU.POFZXJUI1IBOUPN5ZQFT ↟ 4XJGU1IBOUPN5ZQF ྶṞ ↟
1IBOUPN5ZQFθϸϖΩϰᙉͽঢ়ᴋφάψδͫΝ TIJCVZBTXJGU ↑ ঢ়ଶભҠΛ៉ྷʹදݱ͍ͯͯ͠ײಈ
$BTF
/// ΘΓʹ fuga Λ͏͜ͱʂ func hoge() { … }
όλΩϸͩΚ͘Ĉ
%FDMBSBUJPO "UUSJCVUFT ใΛ༩
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(iOS, deprecated=1, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge()
{ … }
ᬋණ ↟ !BWBJMBCMF ↟ !EJTDBSEBCMF3FTVMU 4XJGU͝Λ ↟ !XBSO@VOVTFE@SFTVMU 4XJGUഇᬬ
: Swift3 ͔ΒҰ෦༷͕มߋ͞Ε·͢
ᓸͣ ͖ͣͯͫ͘͝Ħ
ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ