Streaming is available in most browsers,
and in the WWDC app.
What's new in Xcode
Discover the latest productivity and performance advancements in Xcode 14. We'll introduce you to the fully redesigned SwiftUI canvas experience, explore enhancements to code completion and navigation, and take you through performance improvements we've made throughout the entire development process. We'll also show you how you can now read and respond to feedback on your TestFlight builds without ever leaving Xcode.
- Have a question? Ask with tag wwdc2022-110427
- Search the forums for tag wwdc2022-110427
- Author fast and reliable tests for Xcode Cloud
- Build global apps: Localization by example
- Create Swift Package plugins
- Demystify parallelization in Xcode builds
- Link fast: Improve build and launch times
- Meet Swift Package plugins
- Meet Swift Regex
- Track down hangs with Xcode and on-device detection
- Use Xcode to develop a multiplatform app
- What's new in SwiftUI
- WWDC22 Day 1 recap
- WWDC22 Day 2 recap
♪ instrumental hip hop music ♪ ♪ Hello, everyone. I'm Jonathon Mah. And I'm Lisa Xiao. And we'd love to introduce you to what's new in Xcode 14. Today, we'll look at new features and enhancements throughout Xcode, including source editing and SwiftUI previews, multiplatform applications, TestFlight feedback, and performance improvements. There's a lot to cover, so let's get to it. The first thing you'll notice is how much faster it is just getting started. Xcode 14 is 30 percent smaller. It downloads and installs significantly faster. You can download additional platforms and simulators on demand. If you need them immediately, you can get them here -- or later, when you first try to use them.
We're building Food Truck, a food-delivery application.
SwiftUI with live previews is a great workflow, and it's getting even better. Now the preview canvas is interactive by default, so your changes are immediately live as you make them. The canvas has a new control to create additional variants of each preview without writing any code. You can vary the color scheme, text size, or device orientation, and then immediately see your interface rendered in each scenario. Let's see how our view looks with different Dynamic Type sizes.
With these previews side by side, it's easy to validate your interface and make sure things look just right. Let's check the larger sizes.
The first icon is very wide and causes the text to wrap awkwardly. Luckily, my designer has just asked me to change it, but only in the header. Our CardView doesn't support a different icon for the header yet, so let's start by adding that functionality. I'll switch over to the implementation.
The header and content elements are both using the same image. Let's add another image property specifically for the header.
In most of the cards, using the same image in both places looks great. We can save ourselves the time of updating each existing call by adding a custom initializer with a default value.
When I start to type the initializer, Xcode 14 now offers to complete the whole thing! I can accept the default value as a starting point for my customizations, saving a ton of time. This also works for the codable methods. Let's give the headerIcon parameter a default value.
Now, we'll return to the CardStack view and use this new functionality.
My designer asked me to use the calendar symbol here. The library now includes all of the SF Symbols, so it's easy to make sure I'm using the right one.
I can press Return to insert the right code to use the symbol.
This symbol looks great. The new side-by-side comparisons we get from preview variants make it easy to ensure your app looks good with all the settings your users have chosen. In addition to initializer and codable definitions, Xcode 14 provides more intelligent recommendations so you can write your ideas more quickly and easily. Let me show you some more.
When I start to add another CardView, the initializers now appear directly in the completion list. The headerIcon parameter is in italic. That's because it has a default value. If I accept the completion now, it won't include the headerIcon label, it will use the default value we just added. Here, I want to specialize the icon again, so I can type part of the name to opt in.
I'll give my new card some values.
I'd like a divider before my new card. Adding a Divider to the VStack gives a line across the entire width.
To make it more subtle, I'll use frame to set a maximum width.
The frame modifier has a lot of optional arguments. The new completion features make it a snap to get just the arguments I need.
That's code completion in Xcode 14. This first card's title comes from a method. I've heard it isn't handling all numbers correctly, so let's see how it's implemented. I'll Command-click and choose Jump to Definition.
The redesigned definition list highlights what's different about each of the results so that you can quickly choose the one you want. Since our text(for:) method is from a protocol, there are multiple options. The list shows the specific types that define the method: we have the declaration from the protocol and two implementations. I'll navigate to the server-backed implementation.
This class implements parsing using a regular expression literal, which is new in Swift 5.7.
My coworker told me the problem is being caught by our unit tests. Let's run them now.
Yep, we have some failures. Let's take a look.
Something seems wrong with extracting the event count. Let's check how this function is called. I can see that directly by opening the callers of this method by Command-clicking. Just like the definition list, the callers list shows the different files and functions that contain calls to this method, along with a preview of each call site.
Here's a call from the failing test method. The preview shows me the test is passing the string "0 records", which gives me a hint about the problem. And now I can spot the bug: the regular expression is matching against the digits 1-9, but I forgot to include zero! I could fix this by updating the character range to use 0-9, or switch to the more descriptive digit character class.
Something's still not right, but now the compiler is telling me why. Regular expressions are a first-class feature in Swift 5.7. The compiler checks my regular expression like it does with other code, and Xcode highlights my typo immediately. Notice that when I correct the expression, two things happen: syntax highlighting in the regular expression confirms my edit, and the errors dim gray.
This new dimming shows that Xcode is reevaluating the diagnostics. When I pause for a moment, the file is reprocessed and Xcode confirms the errors are resolved. This dimming happens during long builds as well, so you can easily tell which problems are from the latest build and which are from a previous build. Let's go over to the test.
This jumped me straight to the call, which is in the middle of a test method. Take a look at the top of the editor. Xcode 14 shows the definitions containing the visible code, even when they're scrolled out of view.
I can use the test diamonds at the top to rerun the tests.
Fantastic, the fix passes all the tests. With Xcode 14, you can write code faster with new code completions, design fluidly with SwiftUI preview variants, be more informed with improved error presentation, and navigate confidently with jump to definition. And there's even more. Here's Lisa. Thank you, Jonathon. Let's take a look at the build performance improvements. When Xcode builds multiple targets, like a framework and application, first it compiles the framework sources. Then it generates a module. That enables linking and compiling the application sources. And then it links the application, completing the build. Xcode 14 rearranges your build for improved parallelism. By eagerly producing Swift modules, Xcode unblocks build tasks and increases parallelism. It shortens all the critical paths of your builds, all while being more respectful of your simultaneous use of the machine. But we didn't stop there. We also made the linker up to two times faster through increased parallelism. All together, Xcode 14 builds projects up to 25 percent faster, with machines with the most cores seeing the biggest improvements. Even with the improvements to build scheduling, sometimes your project can have internal dependencies on long synchronous tasks. It can be hard to tell this is happening without a visualization. Good news, we've included that in Xcode 14! You can open the new build timeline on any build log or result bundle. It will help you identify unexpectedly long tasks and bottlenecks. Here's the build timeline for Food Truck. I can see a script phase constraining the build to a single core. You can get critical insights and identify performance opportunities in your build with the new build timeline. You can learn all about parallelizing builds, the new build timeline. and linking in "Demystify parallelization in Xcode builds" and "Link Fast: Improve build and launch." Parallel testing in Xcode has been a great way to run your tests faster. In Xcode 14, it's even better. We used the same techniques to improve build performance that I just showed you. Xcode 14 eliminates scheduling dependencies between targets and test classes to increase parallelism during testing even more. If you have long-running tests in different test classes and targets, this feature could improve your test execution time by up to 30 percent. To learn about how to improve test speed and reliability, please check out "Author fast and reliable tests for Xcode Cloud." Building is faster, testing is faster, and preparing your macOS app for distribution is faster too. We have sped up notarization by four times in Xcode 14. For projects using Interface Builder, I have more good news! Document loading is up to 50 percent faster, and switching between iPhones and iPads in the device bar is up to 30 percent faster. Canvas editing operations are incremental and prioritize the scenes you're looking at so that it gives you immediate feedback, even in large storyboards. Xcode 14 is faster, and it's easier to use, too. Let me show you how. Xcode 14 makes it easy to bring your app to different platforms. You can use a single target to define your app, and list what platforms you support. This eliminates the need to keep settings and files in sync, so you only have to describe what's unique on each platform. Check out "Use Xcode to build a multiplatform app" to take advantage of this feature in your project. Xcode also has great tools for making your app smaller. The memory debugger has always been great for exploring leaks in your application. It zeros in on the shortest paths from root objects to unexpectedly live objects so that you can investigate why they've leaked. Xcode 14 expands these capabilities so that you can see all reference paths in and out of an object. In addition to a more thorough explanation of leaks, now you can gauge the total weight of your objects. In Xcode 14, you can also extend Xcode itself with Swift Package plugins. Now packages can integrate plugins that process your code in place, like linters and formatters, and you can invoke them directly from the project navigator. You can also integrate build tools that generate code or process resources while building. For example, you could translate a high-level description of a remote procedure call interface into low-level glue code during the build. You could also compress or optimize resources while building. For an in-depth look at package plugins, check out "Meet Swift Package plugins" and "Create Swift Package plugins." You can also localize package resources just like applications. Now you can set your package's default localization, export the localization catalog, translate it, and reimport it. To learn more about localization, check out "Building global apps: Localization by example." Next, let's move on to the run destination chooser. Switching between devices is something I do all the time, and now it's even easier to get the device you need with the updated run destination chooser. Let's take a look.
When you open the run destination chooser, it shows all the available run destinations for the selected scheme. I often switch between an iPhone and an iPad. The new run destination chooser prioritizes recent choices, which makes this really convenient. It's also easy to select other devices that I haven't used lately. I can filter the list here, and type "max" to bring all the Max devices together and easily pick the one I want. These same features are all available in the Scheme chooser, too. Next, let's take a look at the Organizer window. We've made some great improvements to the Organizer to help you identify new issues and improve your apps. There are two new reports in the Organizer to help you understand how your app is doing on your users' devices: Feedback and Hangs. Let's dive in.
The Feedback organizer shows all of your TestFlight feedback directly in Xcode. Our TestFlight users sent great comments and screenshots for our recent builds. The inspector shows additional details -- like tester information and the device configuration -- that can help to identify the underlying problems. If I need a bit more context, I can email my tester directly with this button. TestFlight feedback is from beta users, but there are some issues that can slip past testing and make it into the App Store. One of the most common types of bugs like this are hangs. Your app hangs when it uses the main thread without taking a break to process user input. Your code might be doing important work, but the user experiences an unresponsive app. This new Hangs report shows the highest-impact hangs from App Store users so that you know which code to restructure to have the biggest impact. On the left, there's a list of hangs ordered by severity. Each one has a weighted backtrace showing the problematic code. Our app supports many devices and OS versions. Some hangs impact certain configurations more than others. In the inspector, it is helpful to find that this hang happens mainly on iOS 15.3. When I'm ready to work on this, I can jump straight into the code with this Open in Project button. The new Hangs and Feedback reports help you triage issues and get the right fixes to users quickly. To learn more about fixing hangs, check out "Track down hangs with Xcode and on-device detection." Next, let's take a look at icons. Our app icon looks great at every size, because we've taken the time to pixel hint and to choose the right number of stripes for every resolution so that it always looks crisp. All of this pixel hinting can be totally essential for some icons and unnecessary for others. Now we have a new icon. Let's take a look at it. These simpler textures don't need any hinting, and will look great drawn at any size. With a double click, I can select the new image. In Xcode 14, you can choose the level of detail that's right for you. For this icon, our single image looks great. I'll use the new Single Size feature to tell Xcode to automatically create all of our different sizes from this one. To do that, I can select Single Size in the inspector. And that's it! That was a brief overview of what's new in Xcode 14. It is faster and easier to help you develop. Thank you for watching! Jonathan: Go download it and get started today! ♪
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.