What’s New in Xcode 12.0?

Swift 5.3, SDKs for iOS/iPadOS/tvOS 14, watchOS 7, and macOS Big Sur

Dmytro Pylypenko
Aug 31 · 5 min read
Image for post
Image for post

In this release, Apple made a lot of improvements around development using Xcode, an approach through SwiftUI and Swift Package Manager (SPM).

Xcode

Image for post
Image for post

New UI/UX design. The navigator fonts are system-related (but can be turned off). The tab navigation is very similar to VS Code, where it has a smart approach to keep the opened file or close it after viewing.

For development:

  • The new code completion dialog is redesigned, takes less space, and “completions are presented much faster”, as Apple claims.
  • More important, for my opinion, is that they improved and redesigned Organizer, which you can use for inspecting specific indicators of your applications that used by customers, such as: crash logs, energy reports and launch time performance, etc.
  • They also added support for Scalable Vector Graphic (SVG) image assets, which supports deployment targets from macOS 10.15, iOS 13, and iPadOS 13.
  • Rendering mode and symbol scale properties of SF Symbols for iOS are editable during selection with the image picker. Additional properties will expand below its image name.
  • A new minimap for Interface Builder canvas, which can be attached to any corner of it, and minimap scene can be focused by double-click and command-click on it.
  • Small but important additions: Interface Builder supports the two/three-column styles for UISplitViewController, which is introduced in iOS 14; support button with UIButton.ButtonType.close type.

SwiftUI

Apple, in development, gets closer to best practices of scalabilities and modularity approaches. For example, your SwiftUI View component can be turned into a reusable component and can be appeared in the Xcode library.

Another performance improvement is having Lazy views. There’s
LazyVStack, LazyHStack, LazyVGrid and LazyHGrid. So, besides classical ones, which are not lazy, for dynamic presentation, it’s a better choice to use lazy views for handling enormous data sets.

As Apple’s development team says:

Application lifecycle in SwiftUI enables entire apps to be written completely in SwiftUI for iOS, iPadOS, and macOS.

Swift

From 5.3, version it is allowed, in escaping closures, to refer to references of a class scope in an implicit way without assigning or calling self explicitly on variables. So calls literally behave like in a simple function, where you don’t need to put obvious self.number, thus your access enclosure can look like in the example:

Image for post
Image for post

Learn more about another feature that is implemented already and in progress:

Swift Packages

Meaningful improvements have been made for the SPM environment, which, I would say, gives the complete opportunity to plan your development and looking to use modularity with assets, using SPM without any other dependency managers. It supports:

  • Containing resources: images, assets, storyboards, localized content, and other files, which Xcode adds automatically to the application bundle during its compiling.
  • Organizing building target dependencies based on custom conditions, for example, if you want to limit per platform or by environment variables/
  • Pre-built libraries, which is the XCFramework, can include .dSYM and .bcsymbolmap — debugging symbol files in your library bundle, using the -debug-symbols flag. For more information use: xcodebuild -create-xcframework -help.
  • And for making some experiments or making fast development, through Playgrounds, an improvement that they can import and use Swift packages and frameworks, to select the Build Active Scheme checkbox in the playground’s File inspector and ensure that the active scheme builds the package or framework target.

Debugging

It looks much smarter and flexible to get detailed explanations about UI efficiency improvements and responsiveness. The suggestions are presented in the debug navigator during debugging on the view hierarchy of the application.

The Swift language diagnostics has drastically improved, and that makes it much easier to understand coding mistakes, especially in SwiftUI code.

Another interesting features in View Debugger, you can see CALayer, by:
Editor → Show Layers to view CALayers,
and check performance runtime issues of CALayer, by:
Editor → Show Optimization Opportunities

With breakpoints, Xcode displays the hit count for that particular breakpoint location as part of the breakpoint’s annotation in the editor and, from now, you can now name a breakpoint, and reference it by name from another breakpoint’s action. For example, to enable your previously disabled breakpoint with name SpecialBreakpoint, type in Debugger Command field:
break enable SpecialBreakpoint to turn it on.

And last but not least, that Xcode prints the crash messages in the Console, with a similar style as it displays in CrashReporter when a process crashes during debugging.

For applications that contain in-app purchases, this is the big improvement for testing and debugging any scenarios, in Simulator or devices, using the new framework StoreKit Test, which can be done completely locally without any connection to App Store servers.

Testing covers:

  • Testing in-app purchase scenarios, with changing subscription statuses.
  • Subscription offers: introductory and promotional.
  • Restore purchases.
  • Ask to buy, interrupted purchases, and more.

And an important feature is controlling your test environment, where it’s possible: resetting offer eligibility, clearing purchase history, and speeding up renewal rate for time-based subscriptions.

For more information on getting started, see Testing In-App Purchases in Xcode and Setting Up StoreKit Testing in Xcode.

Simulator

Here are a few improvements, which makes our development and testing processes using Simulator easier:

  • Stay On Top — a feature that had been removed a long time ago and hopefully resurrected. Your device keeps its position in front of other application windows.
  • It can be located again in Full-Screen mode in one of your spaces in macOS, or tile its window alongside Xcode.
  • Simulator defaults to the internal microphone unless you explicitly choose a different audio source, thus your audio quality won’t be degraded, if you listen to music through a MacBook :)
  • And, a very important thing for testing the new features is simulating Nearby Interaction — dragging the device window around the other simulator will show simulated distance.

Thanks for the reading, I am sure we have learned something new today!
This article will be kept updated regarding new features in Xcode 12.

If you are still on Xcode 11, check what features have be done there.

Better Programming

Advice for programmers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store