Skip to content

Instantly share code, notes, and snippets.

@steventroughtonsmith
Created September 16, 2016 16:43
Show Gist options
  • Save steventroughtonsmith/caf41d017b29e3b5133d129b6b710be7 to your computer and use it in GitHub Desktop.
Save steventroughtonsmith/caf41d017b29e3b5133d129b6b710be7 to your computer and use it in GitHub Desktop.
DrawingKit playground for iOS 10
import PlaygroundSupport
import Foundation
import UIKit
Bundle(path: "/System/Library/PrivateFrameworks/DrawingKit.framework")?.load()
let DKInkView = NSClassFromString("DKInkView") as! UIView.Type
extension UIView {
func newGPUAvailable() -> Bool {
return true
}
}
func swizzleExtensionCheck()
{
let origMethod = class_getClassMethod(DKInkView, NSSelectorFromString("gpuAvailable"))
let newMethod = class_getInstanceMethod(DKInkView,NSSelectorFromString("newGPUAvailable"))
method_exchangeImplementations(origMethod, newMethod)
}
swizzleExtensionCheck()
let view = DKInkView.init()
PlaygroundPage.current.liveView = view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment