Skip to content

Instantly share code, notes, and snippets.

@wtsnz
Created May 8, 2017 01:17
Show Gist options
  • Select an option

  • Save wtsnz/780214509ecab13cfca0ca5397c39c7e to your computer and use it in GitHub Desktop.

Select an option

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

wtsnz commented May 8, 2017

Copy link
Copy Markdown
Author

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