Skip to content

Instantly share code, notes, and snippets.

@algal
Last active October 14, 2015 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save algal/5d8c87c9537524d32871 to your computer and use it in GitHub Desktop.
Save algal/5d8c87c9537524d32871 to your computer and use it in GitHub Desktop.
How to use UIView.recursiveDescription in a Swift playground
let v = UIView()
// use `performSelector` to workaround that the method is private
// use `takeRetainedValue` to get an AnyObject
// use the forced cast because we know it's a string
let s = v.performSelector("recursiveDescription").takeRetainedValue() as! String
// convert the string to a fixed width font, so the quicklook is useful
NSAttributedString(string: s, attributes: [UIFontDescriptorFeatureSettingsAttribute:[UIFontFeatureTypeIdentifierKey:kMonospacedTextSelector]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment