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 ↟ 4XJGU͹1IBOUPN5ZQF ᢮ྶṞ ↟ 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

ͦਗ਼ௌ͔Μ͞ͺ͖ͦͨ͘ΐͩͱĈ