エラーと警告で コードをデザインする ~赤と黄の輪舞曲~
by
Yuka Ezura
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_ 2016/8/20 ezura
Slide 2
Slide 2 text
FSSPS͜ṽͫ͟͝Ħ
Slide 3
Slide 3 text
XBSOJOH͜ṽͫ͟͝Ħ
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
Δͩ͘ͼΛj
Slide 8
Slide 8 text
Δ͵ͺ᪇͡ ཱͺᲇձ͖ͱ͝͵ͱj
Slide 9
Slide 9 text
ဒᘥ ࣮ḝ ᙉණ
Slide 10
Slide 10 text
͟ΝĈ ᦉᷯΔ͔Ν
Slide 11
Slide 11 text
࣮ḝ᧸ͽុΜΤ᧬ͺԫᓸ ᓸͣΑΐͩΙ͘
Slide 12
Slide 12 text
έϮ⑲ͺຓ θ⑲ώΤόλΩϸͫΝ _᧬ͺԫᇷዛູ_
Slide 13
Slide 13 text
↟1IBOUPN5ZQF ↟%FDMBSBUJPO"UUSJCVUFT
Slide 14
Slide 14 text
$BTF
Slide 15
Slide 15 text
class HogeOperation { /// Ұ͚ͩݺͿ͜ͱ func prepare() /// prepare ޙ͔Β͑Δ func execute() /// ͍ͭݺΜͰྑ͍ func mob() }
Slide 16
Slide 16 text
/// Ұ͚ͩݺͿ͜ͱ /// prepare ޙ͔Β͑Δ
Slide 17
Slide 17 text
private var isPrepared = false /// Ұ͚ͩݺͿ͜ͱ func prepare() { guard !isPrepared else { fatalError("prepare() Λෳݺͳ͍͜ͱ") } isPrepared = true }
Slide 18
Slide 18 text
No content
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
όλΩϸͩΚ͘Ĉ
Slide 21
Slide 21 text
1IBOUPN5ZQF ܕใΛར༻ͯ͠ॲཧͷޡΓΛࢦఠՄೳʹ
Slide 22
Slide 22 text
ᴰᨷঢ়ỪΑ ᑿᠭ൱ၙͼϦςψώΤᨷᤅ
Slide 23
Slide 23 text
protocol OperationState {} class Init: OperationState {} class Prepared: OperationState {}
Slide 24
Slide 24 text
class HogeOperation {}
Slide 25
Slide 25 text
extension HogeOperation where State: Init { /// Ұ͚ͩݺͿ͜ͱ func prepared() -> HogeOperation { let readyOp = HogeOperation() // TODO: ඞཁͳσʔλΛҾ͖ܧ͗ return readyOp } }
Slide 26
Slide 26 text
θϸϖΩϰέϮ⑲ ỹ ỹ
Slide 27
Slide 27 text
No content
Slide 28
Slide 28 text
extension HogeOperation where State: Prepared { /// prepare ΛݺΜͩޙ͔Β༻Մೳ func execute() { /* do somethig */ } }
Slide 29
Slide 29 text
θϸϖΩϰέϮ⑲
Slide 30
Slide 30 text
ଓ͟8FC https://gist.github.com/ezura/ f5aebef7bb86edbfd40b0bd1d0435e00
Slide 31
Slide 31 text
1IBOUPN5ZQF͖Ο͖Ο ↟ 'VODUJPOBM4OJQQFU1IBOUPN5ZQFT ↟ 4XJGU.POFZXJUI1IBOUPN5ZQFT ↟ 4XJGU1IBOUPN5ZQF ྶṞ ↟ 1IBOUPN5ZQFθϸϖΩϰᙉͽঢ়ᴋφάψδͫΝ TIJCVZBTXJGU ↑ ঢ়ଶભҠΛ៉ྷʹදݱ͍ͯͯ͠ײಈ
Slide 32
Slide 32 text
$BTF
Slide 33
Slide 33 text
/// ΘΓʹ fuga Λ͏͜ͱʂ func hoge() { … }
Slide 34
Slide 34 text
όλΩϸͩΚ͘Ĉ
Slide 35
Slide 35 text
%FDMBSBUJPO "UUSJCVUFT ใΛ༩
Slide 36
Slide 36 text
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge() { … }
Slide 37
Slide 37 text
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(*, unavailable, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge() { … }
Slide 38
Slide 38 text
/// ΘΓʹ fuga() Λ͏͜ͱʂ @available(iOS, deprecated=1, message="͓ޚ໔͞…(ƅωƅ)", renamed="fuga") func hoge() { … }
Slide 39
Slide 39 text
ᬋණ ↟ !BWBJMBCMF ↟ !EJTDBSEBCMF3FTVMU 4XJGU͝Λ ↟ !XBSO@VOVTFE@SFTVMU 4XJGUഇᬬ : Swift3 ͔ΒҰ෦༷͕มߋ͞Ε·͢
Slide 40
Slide 40 text
ᓸͣ ͖ͣͯͫ͘͝Ħ
Slide 41
Slide 41 text
ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ