This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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