Skip to content

Instantly share code, notes, and snippets.

@Damonvvong
Created February 5, 2018 09:26
Show Gist options
  • Save Damonvvong/1bf8e242fefc947c784a83ac16293e96 to your computer and use it in GitHub Desktop.
Save Damonvvong/1bf8e242fefc947c784a83ac16293e96 to your computer and use it in GitHub Desktop.
private final class BundleToken {}
extension UIImage {
convenience init?(namedInBundle name: String) {
let bundle = Bundle(for: BundleToken.self)
self.init(named: name, in: bundle, compatibleWith: nil)
}
}
UIImage(namedInBundle: "123")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment