Skip to content

Instantly share code, notes, and snippets.

@wtsnz
Created May 8, 2017 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtsnz/780214509ecab13cfca0ca5397c39c7e to your computer and use it in GitHub Desktop.
Save wtsnz/780214509ecab13cfca0ca5397c39c7e to your computer and use it in GitHub Desktop.
Load a UIImage from an xcassets library in your framework.
extension UIImage {
convenience init?(inCurrentBundleNamed: String) {
class BundleClass { }
self.init(named: inCurrentBundleNamed, in: Bundle(for: BundleClass.self), compatibleWith: nil)
}
}
@wtsnz
Copy link
Author

wtsnz commented May 8, 2017

Not sure if I like the name of the method, open to suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment