How to inspect the responder chain?

前端 未结 6 1264
甜味超标
甜味超标 2020-12-08 10:51

I\'m doing some crazy multiple documents inside a single window stuff with the document-based architecture and I\'m 95% done.

I have this two-tier document architect

6条回答
  •  遥遥无期
    2020-12-08 11:39

    Here is the simplest one

        extension UIResponder {
            func responderChain() -> String {
                guard let next = next else {
                    return String(describing: self)
                }
    
                return String(describing: self) + " -> " + next.responderChain()
            }
        }
    
        // ...
    
        print(self.responderChain())
    

提交回复
热议问题