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
Yuka Ezura
August 20, 2016
Technology
6
4k
エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
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.3k
SF Symbols
ezura
9
1.2k
気遣いの iOS プログラミング
ezura
11
3.4k
Secret Swift tour
ezura
7
2.8k
Swift Album ver.4.1
ezura
3
1.4k
Swift と Kotlin
ezura
4
2.6k
哲学とSwiftの発表
ezura
5
580
アプリが動いたその先へ (iOS アプリ開発編)
ezura
1
980
Blending Kotlin's culture into Swift
ezura
1
1.2k
Other Decks in Technology
See All in Technology
RubyでKubernetesプログラミング
sat
PRO
4
150
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
840
When Windows Meets Kubernetes…
pichuang
0
300
20240522 - 躍遷創作理念 @ PicCollage Workshop
dpys
0
310
embedパッケージを深掘りする / Deep Dive into embed Package in Go
task4233
1
200
2025年に挑戦したいこと
molmolken
0
140
Formal Development of Operating Systems in Rust
riru
1
420
20240513 - 框裡框外_文學院學生如何在AI世代安身立命 @ 淡江大學
dpys
0
650
データ基盤におけるIaCの重要性とその運用
mtpooh
1
210
Git scrapingで始める継続的なデータ追跡 / Git Scraping
ohbarye
5
450
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
240
Goで実践するBFP
hiroyaterui
1
120
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Music & Morning Musume
bryan
46
6.3k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Writing Fast Ruby
sferik
628
61k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Gamification - CAS2011
davidbonilla
80
5.1k
Side Projects
sachag
452
42k
Raft: Consensus for Rubyists
vanstee
137
6.7k
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 ͔ΒҰ෦༷͕มߋ͞Ε·͢
ᓸͣ ͖ͣͯͫ͘͝Ħ
ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ