Xcode - is it possible to debug crashes in the Interface Builder's Live Rendering process (IBDesignable)?

后端 未结 2 794
醉梦人生
醉梦人生 2021-02-01 18:17

Question

Is it possible to set breakpoints and debug code executed by Xcode / Interface Builder\'s Live Rendering? That is, I am using the IBDesignable

2条回答
  •  粉色の甜心
    2021-02-01 18:31

    I watched the WWDC video again (§411 @22:00 or so). You have to

    • edit a view in IB, and set its custom class to a class in your codebase
    • set breakpoints as desired in your custom class
    • select the view in IB, then select Editor -> "Debug Selected Views" (at bottom)

    Oddly, in my tests today, it is creating my view via (initWith)Frame instead of (initWith)Coder. This causes subsequent constraint configuration logic to fail as the sub views have not been set (as they would had 'withCoder been called).

提交回复
热议问题