Slide 1

Slide 1 text

&NQUZ4UBUFදࣔڞ௨Խͷࣄྫ QPUBUPUJQT,FOUBSP5BHVDIJ !LFOLFOLFO@

Slide 2

Slide 2 text

֓ཁ ϧʔϧܾΊ ࣮૷ʹ͍ͭͯ Ξ δ Σ ϯ μ

Slide 3

Slide 3 text

֓ཁ

Slide 4

Slide 4 text

&NQUZ4UBUFͷදࣔΛ౷Ұͨ͠ Կ Λ ͠ ͨ ͷ ͔

Slide 5

Slide 5 text

ը໘࡞੒࣌ʹ౎౓σβΠϯɾ࣮૷͞Ε͍ͯͨ ը໘ʹΑͬͯද͕ࣔόϥόϥ σβΠϯɾ࣮૷Λʮߟ͑Δʯ޻਺͕ൃੜ ͳ ͥ ΍ ͬ ͨ ͷ ͔

Slide 6

Slide 6 text

C F G P S F

Slide 7

Slide 7 text

B G U F S

Slide 8

Slide 8 text

w ΞϓϦ಺ͷ&NQUZ4UBUFද͕ࣔ౷Ұ͞Εͨ w ίετ࡟ݮʢاըɾσβΠϯɾ࣮૷ʣ Կ ͕ ಘ Β Ε ͨ ͷ ͔

Slide 9

Slide 9 text

ϧʔϧܾΊ

Slide 10

Slide 10 text

σβΠφʔͱ૬ஊ ࢓༷ɾσβΠϯͷϧʔϧΛܾΊͨ ֓ ཁ

Slide 11

Slide 11 text

จݴΛදࣔ͢Δ͚ͩʢ࠶ݕࡧ౳ͷػೳ͚ͭͳ͍ʣ $73Λ௥͍ͬͯͳ͍ γϯϓϧͳ࢓༷Ͱ0, ࢓ ༷

Slide 12

Slide 12 text

දࣔ͢ΔཁૉʹରԠͨ͠จݴΛఆΊΔ ༧໿৘ใ ʮ༧໿৘ใ͸͋Γ·ͤΜʯ จ ݴ

Slide 13

Slide 13 text

w ϑΥϯτͷαΠζɾΧϥʔΛ౷Ұ w 7JFXͷதԝʹϥϕϧΛ഑ஔ σ β Π ϯ

Slide 14

Slide 14 text

ϧʔϧ͸FTBʹ·ͱΊͯνʔϜʹڞ༗ ʢશࣾһӾཡՄೳʣ ʢΤϯδχΞ޲͚ʹJ04࣮૷·ͱΊ΋هࡌʣ υ Ω ϡ ϝ ϯ τ Խ

Slide 15

Slide 15 text

࣮૷

Slide 16

Slide 16 text

protocolͱenumΛ࢖ͬͯ ൚༻తʹར༻Ͱ͖ΔΑ͏ʹ࣮૷͢Δ ํ ਑

Slide 17

Slide 17 text

FOVNͰදࣔཁૉΛදݱ ରԠ͢Δจݴ΋ఆٛ จ ݴ

Slide 18

Slide 18 text

/// empty stateΛఆٛ͢Δenum enum EmptyState { /// ༧໿ case reservation /// ςʔϒϧ case table // ʢଞলུʣ /// λΠτϧ var title: String { switch self { case .reservation: return NSLocalizedString("key_of_reservation", comment: "") case .table: return NSLocalizedString("key_of_table", comment: “") // ʢଞলུʣ } } }

Slide 19

Slide 19 text

QSJWBUFͰ࣮૷ ֎͔Β༨ܭͳૢ࡞ͤ͞ͳ͍ ݟͨ໨͕౷Ұ͞ΕΔ W J F X

Slide 20

Slide 20 text

/// empty state༻ͷView private final class EmptyStateView: UIView { /// λΠτϧϥϕϧ private let titleLabel: UILabel = { let titleLabel = UILabel() // ϥϕϧͷઃఆ return titleLabel }() init(_ state: EmptyState) { super.init(frame: .zero) setup(with: state) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } /// ηοτΞοϓΛ͢Δ private func setup(with state: EmptyState) { titleLabel.text = state.title addSubview(titleLabel) titleLabel.edges(equalTo: self) } }

Slide 21

Slide 21 text

֎͔Β͸͍ͭ͜Λ͍͡Δ &NQUZ4UBUF7JFXͱಉ͡ϑΝΠϧʹ࣮૷ ) P M E F S

Slide 22

Slide 22 text

/// empty stateΛදࣔ͢ΔViewͷϗϧμʔ final class EmptyStateHolder { /// ຊϓϩύςΟܦ༝ͰviewͷisHiddenΛ֎͔Βηοτ͢Δ var isHidden = false { didSet { view.isHidden = isHidden } } /// empty stateΛදࣔ͢ΔView /// /// fileprivateʹͯ͠༨ܭͳPropertyΛϑΝΠϧ֎͔Βૢ࡞ͤ͞ͳ͍ /// ͱ͢Δ͜ͱͰݟͨ໨͕ΞϓϦ಺Ͱ౷Ұ͞ΕΔ͜ͱΛ୲อ fileprivate let view: EmptyStateView /// state͔Βࣗ਎Λੜ੒͢Δ /// 1ՕॴͰෳ਺λΠϓͷEmptyStateΛग़͢ཁ͕݅ͳ͍લఏͷ࣮૷ /// /// - Parameter state: EmptyState init(_ state: EmptyState) { view = EmptyStateView(state) } }

Slide 23

Slide 23 text

ԼهΛࢀߟʹ&EHFʹର੍ͯ͠໿Λ͚ͭΔ 6*7JFXͷFYUFOTJPOΛ࣮૷ IUUQTTQFBLFSEFDLDPNLBNFJLFGBSFXFMMTOBQLJU ิ ଍ ɿ 7 J F X ͷ F Y U F O T J P O

Slide 24

Slide 24 text

extension UIView { /// ࣗ਎ͷEdgeʹର੍ͯ͠໿Λ͚ͭΔ /// /// - Parameters: /// - view: ੍໿ͷج४ͱͳΔview /// - offset: ੍໿஋ (σϑΥϧτ஋: .zero ) func edges(equalTo view: UIView, offset: UIEdgeInsets = .zero) { translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ topAnchor.constraint(equalTo: view.topAnchor, constant: offset.top), bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -offset.bottom), leftAnchor.constraint(equalTo: view.leftAnchor, constant: offset.left), rightAnchor.constraint(equalTo: view.rightAnchor, constant: -offset.right) ]) } }

Slide 25

Slide 25 text

ڞ௨Խ༻ͷQSPUPDPMΛ࡞੒ Q S P U P D P M

Slide 26

Slide 26 text

// MARK: - ڞ௨Խ༻ϓϩτίϧ /// empty stateදࣔϓϩτίϧ protocol EmptyStateDisplayable where Self: UIResponder { /// empty stateΛදࣔ͢ΔViewͷϗϧμʔ var emptyStateHolder: EmptyStateHolder { get } /// emptyStateViewΛadd͢Δ func addEmptyStateView() }

Slide 27

Slide 27 text

6*7JFX$POUSPMMFSɾ6*7JFX ͦΕͧΕσϑΥϧτ࣮૷Λ௥Ճ ʢجຊˢΛݺͿ͚ͩʣ Q S P U P D P M F Y U F O T J P O

Slide 28

Slide 28 text

// MARK: - UIViewControllerͷ৔߹ extension EmptyStateDisplayable where Self: UIViewController { /// emptyStateViewΛviewʹaddSubview͢Δ func addEmptyStateView() { view.addSubview(emptyStateHolder.view) emptyStateHolder.view.edges(equalTo: view) } } // MARK: - UIViewͷ৔߹ extension EmptyStateDisplayable where Self: UIView { /// emptyStateViewΛࣗ਎ʹaddSubview͢Δ func addEmptyStateView() { addSubview(emptyStateHolder.view) emptyStateHolder.view.edges(equalTo: self) } }

Slide 29

Slide 29 text

/// ར༻ଆͷ࣮૷ྫ /// EmptyStateDisplayableʹ४ڌͤ͞Δ final class SampleViewController: UIViewController, EmptyStateDisplayable { /// EmptyStateDisplayableͷϓϩύςΟ /// ରԠ͢ΔEmptyState(enum)͔ΒॳظԽ let emptyStateHolder = EmptyStateHolder(.reservation) override func viewDidLoad() { super.viewDidLoad() // EmptyStateDisplayableͷϝιουΛݺ΂͹EmptyStateView͕addSubView͞ΕΔ addEmptyStateView() // EmptyStateΛදࣔ͢Δ৚݅ʹ߹ΘͤͯemptyStateHolder.isHiddenʹ஋Ληοτ emptyStateHolder.isHidden = false } }

Slide 30

Slide 30 text

&NQUZ4UBUFͰ͸ָΛͯ͠ ྗΛೖΕΔ΂͖ͱ͜Ζʹ ஫ྗͰ͖ΔΑ͏ʹͳΔͱϋοϐʔ