Skip to content

Instantly share code, notes, and snippets.

@maxchuquimia
Created April 8, 2020 09:37
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxchuquimia/3eb255b0ea2088829b460358d9f058d3 to your computer and use it in GitHub Desktop.
Save maxchuquimia/3eb255b0ea2088829b460358d9f058d3 to your computer and use it in GitHub Desktop.
My .lldbinit
command alias objc expression -l objc -O --
command regex swift 's#(.+)#expression -l Swift -O -- defer { CATransaction.flush() }; %1#'
breakpoint set -n AppDelegate.application --one-shot true --auto-continue true
breakpoint command add
swift import Foundation
swift import UIKit
swift import MyApp_tvOS
swift import MyApp_iOS
swift func $printSubviews(of view: UIView) { print(view.perform("recursiveDescription")!) }
swift func $findViews<C: UIView>(_ c: C.Type, in t: UIView = UIApplication.shared.keyWindow!) -> [C] { var r: [C] = []; t.subviews.forEach({ if let v = $0 as? C { r.append(v) }; r.append(contentsOf: $findViews(C.self, in: $0)) }); return r }
swift func $flush() { CATransaction.flush() }
swift func $view<T>(_ x: T) -> UIView { unsafeBitCast(x, to: UIView.self) }
swift func $vc<T>(_ x: T) -> UIViewController { unsafeBitCast(x, to: UIViewController.self) }
swift func $nav<T>(_ x: T) -> UINavigationController { unsafeBitCast(x, to: UINavigationController.self) }
swift extension NSObject { static func $from(_ addr: UInt) -> Self { unsafeBitCast(addr, to: Self.self) }}
DONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment