Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use current iOS app icon with UIImageView in Swift 2 (Swift 3 example:
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