What’s New in Xcode 16

Yagnikbavishi
Simform Engineering
6 min readJun 12, 2024

--

Explore the new features of Xcode 16, which were revealed at WWDC 24.

With every new version, Xcode — the integrated development environment (IDE) for Apple platforms — keeps changing. In this blog, we will see what new comes in Xcode 16. To download Xcode 16 beta, ensure your Mac is running macOS version 14.5 or higher. You can download the Xcode 16 from here.

In this article, we’ll discuss Editing, Build, Debugging, Testing, and maximizing performance with the instrument tool in Xcode 16.

Editing:

Let’s talk about three things that are new in Editing in Xcode 16.

  • Code completion: It provides more thorough code suggestions and it uses surrounding code context like function names and comments. It is available when Xcode 16 is running in macOS Sequoia.
Code completion Example
  • Swift 6 Updates: Swift 6 new language mode provides the new language mode for concurrency safety guarantees. It converts data races into run-time issues. Now, let's see how we can incrementally enable warring for each upcoming language feature.
Swift Compiler Upcoming language feature

Above the image, you can enable a warning for upcoming language features.

For example: When we set Isolated Global Variables to true then it provides the warning in the issue navigator for concurrency safe.

Please make sure to resolve all warnings before switching to Swift 6 because these warnings will appear as errors. When all things are ready then you can set Swift 6 into the build setting.

Migration Image for converting app into Swift 6
  • Previews improvement: It provides two new APIs for preview improvement.

@Previewable Macro: It will attach the property wrapper like the State and allow us to use it directly within the preview block. Writing wrapper view is not necessary.

@Previewable Macro Example

2. PreviewModifier: It will be easier to share the environment or data for previews. It will help to reduce the duplicate code and also help to enable the preview system to cache the data.

PreviewModifier Example

Build:

Xcode 16 will provide the explicit module which will provide an improved parallelism, better diagnostic, and faster debugging. Objective c will provide the default explicit module but in Swift, you need to enable Explicitly Built modules in the build setting.

Enable explicitly built modules

Improvement in swift package integration in Xcode 16 we can queue update the build without having to wait for package resolution to finish.

Build process with build modules

Using that Xcode will split the build into three phases as mentioned in the above image. Previously module builds were performed internally.

After, Xcode 16 it will be part of compiling your source file so we will get clear error messages if builds fail due to module issues. To learn more about the build module you can check out: https://developer.apple.com/videos/play/wwdc2024/10171.

Debugging:

  • DWARF5 is now the default debug symbol format when building against the deployment of macOS Sequoia or iOS 18. With that dSYM bundle is smaller and the symbol looks faster.
  • When debugging code in Xcode 16 then the thread performance checker is even more.
  1. Main thread hangs: We can enable a unified backtrace view from the debug bar. It will help to visualize the call stack and find the hang issue.

2. Disk write diagnostics: We can see the impact issues have changed different app versions.

3. Launch diagnostics: It will new category in the organizer. Which will be used to check the app's lunch diagnostics logs. Xcode will show the showest code why app launch takes time.

With the new reality kit debugger, we can capture a running app’s entity hierarchy and explore 3D right inside the Xcode. You can learn more about it from Break into the RealityKit debugger and Run, Break, Inspect: Explore effective debugging in LLDB.

Testing:

Writing tests is made simpler with the help of Swift Testing, a new framework including expressive APIs. This test will work right along with XCTests.

Swift Testing Example

With the SwiftTesting framework, we can check the details description of why a test failed by expanding the result. You can check more about the Swift Testing framework by Go further with Swift Testing and Meet Swift Testing.

StoreKit testing in Xcode

  • Configure App Policies: Add user license agreements and localized privacy policies in the StoreKit.configuration file to ensure they appear in StoreKit views.
  • Test Win-Back Offers: Set up win-back offers for auto-renewable memberships by configuring them in the StoreKit.configuration file.

Maximizing performance with the instrument tool:

Instrument 16’s frame new Flame graph will provide a high-level overview of trace execution.

Instrument 16’s frame new Flame graph

Now let’s talk more about the features of Xcode 16.

Projects and workspaces

  • We can quickly create a swift file from Project Navigator’s context menu without any confirmation dialog.
  • Use the Copy, Paste, and Duplicate options in the Edit menu to quickly generate a new file from an existing one.
  • To quickly create a new file from part of a source file, cut the desired text from the Source Editor. Then, hold the Option key and select the “New File from Clipboard” command in the context menu of the Project Navigator.

Devices and simulator

  • FaceTime and SharePlay support are available for Vision OS with an upgraded simulator.
  • Xcode will start the project quickly because the simulator update resumes even after your download gets interrupted. Also, Settings -> Components which helps to manage downloadable components.

Asset Management

  • We can add new dark and tinted app icons for iOS in Xcode 16.

Xcode cloud

  • It will define the custom aliased setup centralized Xcode and macOS configurations. Also, we can view the coverage data in the Xcode cloud by opening the build report under the report navigator in Xcode.

Localization

  • Xcode 16 gives new features for the string catalog such as inline diagnostics and the ability to mark strings as not to be translated.

Conclusion

Xcode 16 is a major advancement in Apple’s development tools, introducing powerful new features to boost developer productivity and simplify coding. It includes advanced AI capabilities for code completion and testing, deeper integration with Swift 6, and enhancements across SwiftUI and other frameworks. These improvements make app development more efficient and enjoyable.

Note: Currently, Xcode 16 is in beta version. There will be some crash issues so please check once before using it.

For more updates on the latest tools and technologies, follow the Simform Engineering Blog.

Follow us: Twitter | LinkedIn

--

--