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 Foundation | |
/* | |
██████╗ █████╗ ███╗ ██╗ ██████╗ ███████╗██████╗ ███████╗ ██████╗ ███╗ ██╗███████╗ | |
██╔══██╗██╔══██╗████╗ ██║██╔════╝ ██╔════╝██╔══██╗ ╚══███╔╝██╔═══██╗████╗ ██║██╔════╝ | |
██║ ██║███████║██╔██╗ ██║██║ ███╗█████╗ ██████╔╝ ███╔╝ ██║ ██║██╔██╗ ██║█████╗ | |
██║ ██║██╔══██║██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗ ███╔╝ ██║ ██║██║╚██╗██║██╔══╝ | |
██████╔╝██║ ██║██║ ╚████║╚██████╔╝███████╗██║ ██║ ███████╗╚██████╔╝██║ ╚████║███████╗ | |
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ | |
*/ |
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
public extension UIColor { | |
private static let rzl_swizzleImplementation: Void = { | |
let instance: UIColor = UIColor.red // This is a `UICachedDeviceRGBColor` instance. For some reason you have to use red. | |
let _class: AnyClass! = object_getClass(instance) | |
let originalMethod = class_getInstanceMethod(_class, #selector(getter: cgColor)) | |
let swizzledMethod = class_getInstanceMethod(_class, #selector(rzl_randomCGColor)) |
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
public extension UIColor { | |
private struct StaticVars { | |
// Names of classes to swizzle. Derived from dumped private headers. | |
static let classesToSwizzle: [String] = [ | |
"UIColor", | |
"UIDeviceRGBColor", | |
"NSColor", | |
"UIDisplayP3Color", | |
"UIPlaceholderColor", |
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
// MIT License - © 2017 Jonathan Cole. | |
import Cocoa | |
/** | |
A view with the ability to hide itself if the user clicks outside of it. | |
*/ | |
class ModalView: NSView { | |
private var monitor: Any? | |
NewerOlder