Slide 1

Slide 1 text

-JHIUXFJHIU%FQFOEFODZ*OKFDUJPOUJQT !NPUPLJFF QPUBUPUJQT

Slide 2

Slide 2 text

ࣗݾ঺հ w !NPUPLJFF w J04ΤϯδχΞ w ϝϧΧϦι΢κ΢ॴଐ w ϝϧΧϦΧ΢ϧνʔϜ w J04%$+BQBOελοϑ

Slide 3

Slide 3 text

lϝϧΧϦΧ΢ϧzϦϦʔε

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

ϦϦʔε͔Β൒݄

Slide 7

Slide 7 text

w ؤுͬͨߕ൹͋ͬͯɺͷϦϦʔεޙ೔ؒɺ
 ΞϓϦ͸͔ͳΓ҆ఆ͍ͯ͠Δ

Slide 8

Slide 8 text

w ͍Ζ͍ΖͳऔΓ૊Έ͕ޭΛ૗͍ͯ͠Δ͕ɺͦͷ͏ͪ ͷҰ͕ͭ%FQFOEFODZ*OKFDUJPO w 88%$ͷ*NQSPWJOH&YJTUJOH"QQTXJUI.PEFSO #FTU1SBDUJDFTͱ͍͏ηογϣϯͰ΋%*ʹ͍ͭͯऔ Γ্͛ΒΕ͍ͯͯ"QQMF͕ϕετϓϥΫςΟεΛ঺ հ͍ͯ͠Δ 2JJUBʹ·ͱΊ͍ͯ·͢

Slide 9

Slide 9 text

IUUQRJJUBDPNNPUPLJFFJUFNTEBEFFD

Slide 10

Slide 10 text

*NQSPWJOH&YJTUJOH"QQTXJUI.PEFSO#FTU1SBDUJDFT88%$ IUUQEFWTUSFBNJOHBQQMFDPNWJEFPTXXEDSSUZNHDZZUIWX @JNQSPWJOH@FYJTUJOH@BQQT@XJUI@NPEFSO@CFTU@QSBDUJDFTQEG

Slide 11

Slide 11 text

*NQSPWJOH&YJTUJOH"QQTXJUI.PEFSO#FTU1SBDUJDFT88%$ IUUQEFWTUSFBNJOHBQQMFDPNWJEFPTXXEDSSUZNHDZZUIWX @JNQSPWJOH@FYJTUJOH@BQQT@XJUI@NPEFSO@CFTU@QSBDUJDFTQEG

Slide 12

Slide 12 text

͜͜Ͱ঺հ͞Ε͍ͯΔํ๏ͷΑ͘ͳ͍ͱ͜Ζ w 4FHVFͰભҠΛߦ͏৔߹ɺ֤ॴͰґଘΦϒδΣΫτ Λ౉͢ඞཁ͕͋Δ w %3:ʹͳΓʹ͍͘ w ඞཁͳΦϒδΣΫτΛ౉͞ͳͯ͘΋ίϯύΠϥ͕ ΤϥʔΛग़ͯ͘͠Εͳ͍ w ˠҙਤ͠ͳ͍༻్Ͱ࢖ΘΕͨ৔߹ʹɺͰ͖ΔݶΓ ίϯύΠϥΤϥʔΛग़͢ίʔυΛॻ͖͍ͨ

Slide 13

Slide 13 text

͜͜Ͱ঺հ͞Ε͍ͯΔํ๏ͷΑ͘ͳ͍ͱ͜Ζ w 4FHVFͰભҠΛߦ͏৔߹ɺ֤ॴͰґଘΦϒδΣΫτ Λ౉͢ඞཁ͕͋Δ w %3:ʹͳΓʹ͍͘ w ඞཁͳΦϒδΣΫτΛ౉͞ͳͯ͘΋ίϯύΠϥ͕ ΤϥʔΛग़ͯ͘͠Εͳ͍ w ˠҙਤ͠ͳ͍༻్Ͱ࢖ΘΕͨ৔߹ʹɺͰ͖ΔݶΓ ίϯύΠϥΤϥʔΛग़͢ίʔυΛॻ͖͍ͨ

Slide 14

Slide 14 text

r!@JTILBXB lྑ͍ઃܭ͸ޡͬͨ༻๏ΛίϯύΠϧΤϥʔʹ͢Δz

Slide 15

Slide 15 text

ϝϧΧϦΧ΢ϧͰͷϧʔϧ w %*ͳ7JFX$POUSPMMFSΛఆٛͯ͠ɺ7JFX$POUSPMMFSͷ ΠϯελϯεԽ͸ίʔυͰߦ͏ w ը໘ͷϨΠΞ΢τ͸4UPSZCPBSEͰఆٛ͠ɺΠϯε λϯεԽͱભҠΛίʔυͰॻ͘

Slide 16

Slide 16 text

ܦҢ w ϝϧΧϦΞοςͷ։ൃΛଓ͚ΔதͰɺʮ4FHVFΛ΍ΊΑ ͏ʯͱ͍͏ྲྀΕ͕Ͱ͖ͨ w ίʔυΛॻ͖ଓ͚͍ͯ͘தͰݟ͚ͭͨ w ϝϧΧϦΞοςͰ͸ը໘ͷભҠʹ4FHVFΛ࢖͍ͬͯͨ w ެ։ͨ͘͠ͳ͍ϓϩύςΟΛެ։͢Δඞཁ͕͋ͬͨ w ػೳ͕૿͍͑ͯ͘ͱͱ΋ʹԿΛઃఆ͠ͳ͚Ε͹͍͚ͳ ͍ͷ͔͕෼͔Βͳ͘ͳΓෳࡶʹͳ͍ͬͯͬͨ

Slide 17

Slide 17 text

%FQFOEFODZ*OKFDUBCMFQSPUPDPM

Slide 18

Slide 18 text

೉͍͜͠ͱ͸͍ͯ͠ͳͯ͘ɺ ͜Ε͚ͩ

Slide 19

Slide 19 text

protocol DependencyInjectable { associatedtype Dependency static func make(withDependency dependency: Dependency) -> Self }

Slide 20

Slide 20 text

࢖͍ํ %FQFOEFODZ*OKFDUBCMFͳ7JFX$POUSPMMFSͷఆٛํ๏

Slide 21

Slide 21 text

final class WebViewController: UIViewController, DependencyInjectable { private var url: URL! typealias Dependency = URL static func make(withDependency dependency: Dependency) -> WebViewController { let vc = WebViewController.instantiateInitialViewController(with: "WebViewController") vc.url = dependency return vc } } ґଘ͢ΔΦϒδΣΫτͷఆٛ

Slide 22

Slide 22 text

final class WebViewController: UIViewController, DependencyInjectable { private var url: URL! typealias Dependency = URL static func make(withDependency dependency: Dependency) -> WebViewController { let vc = WebViewController.instantiateInitialViewController(with: "WebViewController") vc.url = dependency return vc } } %*ͳ7JFX$POUSPMMFSͷΠϯελϯε͸ɺ NBLFϝιουͰੜ੒͢Δ

Slide 23

Slide 23 text

4FHVFͷ৔߹

Slide 24

Slide 24 text

override func prepare(for segue: UIStoryboardSegue, sender: Any?) { switch segue.destination { case let vc as WebViewController: vc.url = url default: break } } VSMΛ֎෦ʹެ։͢Δඞཁ͕͋Δ ͜ͷ7JFX$POUSPMMFSΛݺͼग़͢৔ॴ͕૿͑ͨ৔߹ɺͦͷ౎౓͜ͷίʔυΛ ॻ͘ඞཁ͕͋Δ

Slide 25

Slide 25 text

final class WebViewController: UIViewController, DependencyInjectable { private var url: URL! typealias Dependency = URL static func make(withDependency dependency: Dependency) -> WebViewController { let vc = WebViewController.instantiateInitialViewController(with: "WebViewController") vc.url = dependency return vc } } VSMΛQSJWBUFʹͰ͖Δ ΠϯελϯεԽͷํ๏͕౷Ұ͞Ε͍ͯΔ͜ͱͰ%3:ݪଇΛकΕΔ

Slide 26

Slide 26 text

final class WebViewController: UIViewController, DependencyInjectable { private var url: URL! typealias Dependency = URL static func make(withDependency dependency: Dependency) -> WebViewController { let vc = WebViewController.instantiateInitialViewController(with: "WebViewController") vc.url = dependency return vc } } ͜Ε͚ͩݟΔͱ4FHVFͷํ͕ศརʹݟ͑Δ͕ɺ΋ͬͱෳࡶͳґଘੑ Λ஫ೖ͢Δඞཁ͕Ͱ͖ͨ৔߹ʹɺ4FHVFΛ࢖ͬͨํࣜ͸͔ͳΓ໘౗ ͳ͜ͱʹͳΔ

Slide 27

Slide 27 text

final class WebViewController: UIViewController, DependencyInjectable { private var url: URL! private var customUserAgent: String? struct Dependency { let url: URL let customUserAgent: String? } static func make(withDependency dependency: Dependency) -> WebViewController { let vc = WebViewController.instantiateInitialViewController(with: "WebViewController") vc.url = dependency.url vc.customUserAgent = dependency.customUserAgent return vc } } ྫͱͯ͠͸ɺ8FC7JFXʹઃఆ͢ΔDVTUPN6TF"HFOUΛมߋ͢Δඞཁ ͕͋Δ৔߹ɺ͜ͷΑ͏ʹ%FQFOEFODZTUSVDUΛఆٛͰ͖ɺNBLFϝ ιου಺Ͱ׬݁ͤ͞Δ͜ͱ͕Ͱ͖Δ

Slide 28

Slide 28 text

࢖͍ํ %FQFOEFODZ*OKFDUBCMFͳ7JFX$POUSPMMFSͷ࢖͍ํ

Slide 29

Slide 29 text

let vc = WebViewController.make(withDependency: url) navigationController?.pushViewController(vc, animated: true)

Slide 30

Slide 30 text

let vc = WebViewController.make(withDependency: url) navigationController?.pushViewController(vc, animated: true)

Slide 31

Slide 31 text

ຖճNBLF͢Δͷ͕໘౗ ભҠ͸΄ͱΜͲͷέʔεͰQVTI͔NPEBM ˠந৅Խ͍ͨ͠

Slide 32

Slide 32 text

extension UIViewController { func present(viewControllerType: DI.Type, dependency: DI.Dependency, withNavigationType navigationType: UINavigationController.Type? = nil, animated: Bool = true, completion: (() -> Swift.Void)? = nil) where DI: UIViewController { let vc = viewControllerType.make(withDependency: dependency) if let navigationType = navigationType { let nav = navigationType.init(rootViewController: vc) present(nav, animated: animated, completion: completion) } else { present(vc, animated: animated, completion: completion) } } func push(viewControllerType: DI.Type, dependency: DI.Dependency, animated: Bool = true) where DI: UIViewController { let vc = viewControllerType.make(withDependency: dependency) navigationController?.pushViewController(vc, animated: animated) } } %FQFOEFODZ*OKFDUBCMFΛ࢖ͬͯભҠ࣌ͷίʔυΛந৅Խ

Slide 33

Slide 33 text

push(viewControllerType: WebViewController.self, dependency: url) present(viewControllerType: WebViewController.self, dependency: url, withNavigationType: CustomNavigationController.self) %FQFOEFODZ*OKFDUBCMFϓϩτίϧͷந৅Խͷ͓ӄͰɺ ͜Μͳײ͡Ͱָʹॻ͚ΔΑ͏ʹͳͬͨʂ

Slide 34

Slide 34 text

push(viewControllerType: WebViewController.self, dependency: url) present(viewControllerType: WebViewController.self, dependency: url, withNavigationType: CustomNavigationController.self) ͍͖ͳΓ͜͜ʹͨͲΓண͍ͨΘ͚Ͱ͸ͳ͘ɺϦϑΝΫλϦϯάΛ ܁Γฦ͍ͯ͘͠தͰ͍·ͷܗʹͳ͍ͬͯͬͨ

Slide 35

Slide 35 text

·ͱΊ

Slide 36

Slide 36 text

ྑ͍ͱ͜Ζ w ΠϯελϯεԽͷํ๏͕౷Ұ͞ΕΔ w ౷Ұ͞ΕΔ͜ͱʹΑͬͯ%3:ʹ w ࠶ར༻ָ͕ʹͳͬͨ w ґଘੑ͕ͳ͍6*7JFX$POUSPMMFSͰ΋ %FQFOEFODZ*OKFDUBCMFʹ͓ͯ͘͜͠ͱʹΑͬ ͯɺޙ͔Βґଘੑ͕௥Ճ͞Εͨͱ͖ʹαΫοͱର Ԡ͢Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳͬͨ

Slide 37

Slide 37 text

͋Μ·ྑ͘ͳ͍ͱ͜Ζ w 4UPSZCPBSEͷ4FHVFΛ࢖Θͳ͍ͱ͍͏બ୒Λͨ͠ͷͰɺ 4UPSZCPBSEͰը໘ؒͷભҠ͕೺ѲͰ͖ͳ͘ͳͬͨ w ˠ$PPSEJOBUPSΫϥεͷΑ͏ͳ΋ͷΛ௥Ճ͢Δ͜ͱͰ 4UPSZCPBSE্ͰΘ͔Βͳͯ͘΋ίʔυͰՄಡͳঢ়ଶʹ͍ͨ͠ w ݱঢ়ɺ4UPSZCPBSE͔ΒΠϯελϯεԽ͍ͯ͠Δ෦෼͸4UPSZCPBSE ΍Ϋϥε໊͕มߋ͞Εͨͱ͖ʹյΕΔ w NBLFͰΠϯελϯεੜ੒Ͱ͖Δ͔ͷςετΛॻ͘͜ͱͰ࠷ ௿ݶͷΧόʔΛ໨ࢦ͢

Slide 38

Slide 38 text

͓ΘΓ