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
+ (CGRect) screenFrame | |
{ | |
CGRect screenRect = [[UIScreen mainScreen] bounds]; | |
return screenRect; | |
} | |
+ (UIImage *)convertViewToImage | |
{ | |
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; |
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
func associatedObject<T: AnyObject>( | |
base: AnyObject, | |
key: UnsafePointer<UInt8>, | |
initialiser: () -> T) | |
-> T { | |
if let associated = objc_getAssociatedObject(base, key) | |
as? T { return associated } | |
let associated = initialiser() | |
objc_setAssociatedObject(base, key, associated, | |
.OBJC_ASSOCIATION_RETAIN) |
NewerOlder