Skip to content

Instantly share code, notes, and snippets.

View Athosone's full-sized avatar

WERCK Ayrton Athosone

  • Lyon, France
View GitHub Profile
+ (CGRect) screenFrame
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
return screenRect;
}
+ (UIImage *)convertViewToImage
{
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
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)