Last active
April 12, 2017 23:52
-
-
Save alana-mullen/684601e86f2d8c283c65 to your computer and use it in GitHub Desktop.
Use current iOS app icon with UIImageView in Swift 2 (Swift 3 example: https://gist.github.com/thewirelessguy/b0eba855c0307b47168be85291788746)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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