Created
September 7, 2018 22:07
-
-
Save fcaldarelli/d4f80f831bee076556efac7d5f0ec060 to your computer and use it in GitHub Desktop.
Add properties to swift extensions
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
typealias IMG_VIEW_REQUESTS_TYPE = [ UIImageView : [String] ] | |
private struct AssociatedKey { | |
static var imgViewRequests = "imageCache_imgViewRequests" | |
} | |
var imgViewRequests : IMG_VIEW_REQUESTS_TYPE { | |
get { | |
return objc_getAssociatedObject(self, &AssociatedKey.imgViewRequests) as! SmartSingleton.IMG_VIEW_REQUESTS_TYPE | |
} | |
set(downloader) { | |
objc_setAssociatedObject(self, &AssociatedKey.imgViewRequests, downloader, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment