recursiveDescription method in Swift?

前端 未结 8 936
天命终不由人
天命终不由人 2020-12-23 09:50

Is there a way to use [self.view recursiveDescription] in Swift? I am trying to use this method but I am getting the following error:

\'UIView\' does not hav         


        
8条回答
  •  一整个雨季
    2020-12-23 10:29

    First add a category @interface without @implementation in your bridging header.

    @interface UIView (Debug)
    - (id)recursiveDescription;
    - (id)_autolayoutTrace;  // This one is even sweeter
    @end
    

    then in your console

    po self.recursiveDescription() as NSString
    po self._autolayoutTrace() as NSString
    

    The key here is as NSString not as String

提交回复
热议问题