Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use current iOS app icon with UIImageView in Swift 2 (Swift 3 example: https://gist.github.com/thewirelessguy/b0eba855c0307b47168be85291788746)
let primaryIconsDictionary = NSBundle.mainBundle().infoDictionary?["CFBundleIcons"]?["CFBundlePrimaryIcon"] as? NSDictionary
let iconFiles = primaryIconsDictionary!["CFBundleIconFiles"] as! NSArray
let lastIcon = iconFiles.lastObject as! NSString //last seems to be largest, use first for smallest
let theIcon = UIImage(named: lastIcon as String)
let iconImageView = UIImageView(image: theIcon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.