Xcode 12 / iOS 14 / Big Sur
Spring quarter is always interesting timing for CS193p since Apple's Worldwide Developers Conference (WWDC) happens right after it ends and usually introduces a lot of new stuff. Luckily the majority of the many changes to SwiftUI at WWDC this year were entirely additive and would not have changed what we did in lecture very much (mostly a lot less typing of "self."!). What is more, some of the new features fit very nicely into the lecture demos. To see this in action, attached below is a version of EmojiArt updated to take advantage of some of what was introduced at WWDC. The code must be built using Xcode 12 and builds an application that runs only on iOS 14 and/or Big Sur.
One of the most notable changes is that it has been converted to be a "pure SwiftUI" app (e.g. no more UIKit code like SceneDelegate) and use the new DocumentGroup capability. This turns EmojiArt into a multi-document application and makes it work as a native application on both iOS and on the Mac. Not much code is required to do this. In fact, most of what is required is to add undo functionality to EmojiArtDocument (which we are happy to have anyway, of course). While we're at it, we also now properly store the image data for the background in the document (when necessary, e.g. you use a photo from the camera as the background) instead of the URL-izing workaround (hackery?) from lecture.
The other major change is to the emoji palette UI. It has been completely reworked to utilize a context menu approach rather than a modal sheet for editing. This is somewhat of an "experimental" UI for the palette, but is a fun, quite different way of approaching it than we did in lecture.
New stuff is marked with "// new" comments throughout.