Upgrade to Pro — share decks privately, control downloads, hide ads and more …

つまづいた時のデバッグ術 / yumemi-swift-how-to-debug

つまづいた時のデバッグ術 / yumemi-swift-how-to-debug

IshibaSeiko

May 15, 2020
Tweet

Other Decks in Programming

Transcript

  1. ͭ·͍ͮͨ࣌ͷσόοάज़ w ࣗݾ঺հ w എܠͱ໨త w σόοάज़ w QSJOUPCKFDU w

    #SFBLQPJOU "DUJPO w &YDFQUJPO#SFBLQPJOU w 7JFX%FCVH
  2. 2 ੴ৔ਗ਼ࢠ ͍͠͹͍ͤ͜ w J04ΤϯδχΞ w ࣮຿ܦݧ೥ ೥݄d  w

    Swiftେ޷͖ w (JUIVC • https://github.com/IshibaSeiko w 2JJUB • https://qiita.com/seikoseikou w 5XJUUFS • @seikoseikou w #MPH • https://seikoseikou.com
  3. 5 ࠓ೔঺հ͢Δσόοάज़ • print object w ஋Λ֬ೝ͍ͨ͠ • Breakpoint +

    Action w ॲཧΛ௨Δͨͼʹ஋Λ֬ೝ͍ͨ͠ • Exception Breakpoint w ΞϓϦΫϥογϡͷݪҼ͕஌Γ͍ͨ • View Debug w UI্ͷ໰୊Λ஌Γ͍ͨ
  4. 6 σόοάज़print object import UIKit class ViewController: UIViewController { override

    func viewDidLoad() { super.viewDidLoad() } @IBAction func didTapSwapButton(_ sender: UIButton) { view.bringSubviewToFront(view.subviews[1]) } } ϚδοΫφϯόʔ͔ͩΒɺ ͲͷView͕औಘ͞ΕΔ͔Θ͔Βͳ͍
  5. 7 Α͋͘Δ΍Γํ ໰୊఺ @IBAction func viewSwapButton(_ sender: UIButton) { view.bringSubviewToFront(view.subviews[1])

    print(view.subviews[1]) } • ֬ೝ͢ΔͨΊʹ͸Build͢Δඞཁ͕͋Δ • ػೳͱͯ͠ෆཁͳίʔυΛهड़͢Δ͜ͱͱͳΔ
  6. 19 ·ͱΊ • print object w ίϯιʔϧͰApo{֬ೝ͍ͨ͠ίʔυ}AΛೖྗ͢Δ • Breakpoint +

    Action w ઃఆͨ͠BreakpointΛμϒϧλοϓͯ͠actionΛ௥Ճ͢Δ • Exception Breakpoint w Breakpoint NavigatorࠨԼͷʮ ʯ͔Β Exception BreakpointΛ௥Ճ͢Δ • View Debug w Debug View HierarchyΛλοϓ͢Δ