iCalvin.org

iOS 10.3 Beta Alternate Icons

Yesterday the first beta of iOS 10.3 launched, and although I previously had been looking forward to this release to quench my curiosity over the rumored Theater Mode it turned out to be a pretty exciting release.

Every now and then Apple gives a few new features to developers during a 'point' release, but typically these come with new hardware to support them, and to preserve the surprise aren't featured in the first beta of a release. One example is 2015's ´ú┐Pencil, which launched alongside iOS 9.1 with before unseen drawing APIs. This release, however, seems to suggest that Apple is committing to supporting developers outside of June's WWDC.

The biggest news I found in the release notes was the ability to set Alternate App Icons, which will allow developers to give users more control over how apps are displayed in Springboard and throughout the system. Obvious usage would be for status applications, such as weather apps that could change their icons based on the current weather. Upon closer inspection, however, it seems that this feature requires some level of user interaction to be able to work correctly. Maybe this is a change to support the long-rumored 'Dark Mode' for iOS, giving developers a way to provide a light and dark icon, although I would hope that a switch like that would happen all at once on a system level.

Since I couldn't find any clear documentation on how this feature works or how developers could start using it I decided to make a test project and write up a quick summary of my experiences here. First I tried updating the icon in the main ViewController's viewDidLoad method, just to try it as early as I could, but that kept giving me the error "The operation was cancelled.". If I move the exact same code to viewDidAppear however it works fine and I get the Alert informing the user that the Icon changed. At this point early in the beta period it could be that either Apple doesn't want these changes to happen automatically without giving the user a chance to actually approve the change, or this API just isn't quite bug-free yet (which is certainly true.)

Another problem I seemed to have was that my preferred method of adding App Icons to the app, through the XCAsset catalog, doesn't seem to play well with the alternate icons. There was no way I could set up the alternate icon files in the asset catalog that would allow me to update the icon correctly. If I added an alternate Icon Set to the main asset catalog named "Green" for instance, when I tried to set that alternate icon from the view controller I would see the confirmation and the App Icon preview in the default confirmation pop up, but the icon didn't actually change. When I go to the home screen I still see the default App Icon the I created in the asset catalog. If, however, I have the file Green@2x.png in the project directory it would work as expected. I'm not sure if this is a bug with the current implementation in the first beta but I sure hope I can use asset catalogs for these alternate icons in the future.

The biggest hurdle though that I experienced setting up this test project was figuring out the Info.plist structure to define the set of supported Alternate Icons. I started developing for iOS with iOS 7 and Xcode 5, and was never really familiar with setting Icons outside of Asset catalogs, so the Info.plist structure to support this was foreign to me, and I couldn't find any clear documentation on the feature. For those like me who are struggling to figure out the flow, [here](https://github.com/cchestnut91/Alt-Icons/blob/master/Alt Icons/Info.plist) is my Info.plist for my test project with the correct structure.

All in all I'm really excited about this, and all of the other new features coming for developers (and users) in 10.3, like a System level API for requesting app reviews, developer replies to reviews on the App Store, the switch to APFS, and a nice quality of life change for CarPlay that I am certainly appreciating. It's looking to shape up to a very strong 'point' release. Now let's just cross our fingers for some interesting hardware to come alongside it. ­čĄ×