Created
September 16, 2016 16:43
-
-
Save steventroughtonsmith/caf41d017b29e3b5133d129b6b710be7 to your computer and use it in GitHub Desktop.
DrawingKit playground for iOS 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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