Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Created

A Summary of the WWDC25 Group Lab - Developer Tools
At WWDC25 we launched a new type of Lab event for the developer community - Group Labs. A Group Lab is a panel Q&A designed for a large audience of developers. Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the WWDC25 Group Lab for Developer Tools. Will my project codebase be used for training when I use Xcode's intelligent assistant powered by cloud-based models? When using ChatGPT without logging in, your data will not be used to improve any models. If you log in to a ChatGPT account, this is based on your ChatGPT account settings, which allows you to opt-out (it defaults to on). When using Xcode with accounts for other model providers, you should check with the policies of your provider. And finally, at no point will any portion of your codebase be used to train or improve any Apple models. We'd love to make our SwiftUI Previews (and soon, Playgrounds) as snappy as possible. Is there any way to skip certain build steps, such as running linters? It seems the build environment is exactly the same (compared to a debug build), but maybe there's a trick. Starting with Xcode 16, SwiftUI previews use the exact same build artifacts as the regular build. The new Playgrounds support in Xcode 26 uses these build artifacts too. Shell script build phases are the most common thing that introduces extra build time, so as a first step, try turning off all shell script build phases (like linters) to get an idea if that’s the issue. If those build phases add significant time to your build, consider moving some of those phases into asynchronous steps, such as running linters before committing instead of on every build. If you do need a shell script build phase to run during your build, make sure to explicitly define the input and output files, as that is a huge way to improve your build performance. Are we able to provide additional context for the models, like coding standards? Documentation for third party dependencies? Documentation on your own codebase that explains things like architecture and more? In general, Xcode will automatically search for the right context based on the question and the evolving answer, as the model can interact multiple times with your project as it develops an answer. This will automatically pick up the coding style of the code it sees, and can include files that contain architecture comments, etc. Beyond automatic context, you can manually attach other documents, even if they aren't in your project. For example, you could make a file with rules and ideas and attach it, and it will influence the response. We are very aware of other kinds of automatic context like rule files, etc, though Xcode does not support these at this time. Once ChatGPT is enabled for Coding Intelligence in Xcode 26, and I sign into my existing ChatGPT account, will the ChatGPT Coding Intelligence model in Xcode know about chat conversations on Xcode development done previously in the ChatGPT Mac app? Xcode does not use information from other conversations, and conversations started in Xcode are not accessible in the web UI or ChatGPT app. Is there a plan to make SwiftUI views easier to locate and understand in the view hierarchy like UIKit views? SwiftUI uses a declarative paradigm to define your user interface. That allows you to specify what you want, with the system translating that into an efficient representation at runtime. Unlike traditional AppKit and UIKit, seeing the runtime representation of SwiftUI views isn't sufficient in order to understand why it's not doing what you want. This year, we introduced a SwiftUI Instrument that shows why things are happening, like view re-rendering. Is it possible to use the AI chat with ChatGPT Enterprise? My company doesn't allow us to use the general ChatGPT, only the enterprise version they have setup that prevents data from being leaked Yes, Xcode 26 supports logging into any existing ChatGPT account, including enterprise accounts. If that does not meet your needs, you can also setup a local server that implements the popular chat completions REST API to talk to your enterprise account how you need. Now that Icon Composer is here, how does it complement or replace existing vector design tools such as Sketch for icon design? Icon Composer complements your existing vector design tools. You should continue to create your shapes, gradients, and layers in another tool like Sketch, and compose the exported SVG layers in Icon Composer. Once you bring your layers into Icon Composer, you can then use it to influence the translucency, blur, and specular highlights for your icon. What’s one feature or improvement in the new Xcode that you personally think developers will love, but might not immediately discover? Maybe something tucked away or quietly powerful that’s flown under the radar so far? One feature we're particularly excited about is the new power profiler for iOS, which gives you further insights into the energy consumption of your app beyond what was possible with the energy instrument previously. You can learn more about how to use this instrument and how it can help you greatly reduce your apps battery usage in the documentation, as well as the session Profile and optimize power usage in your app. There were also improvements in accessibility this year with Voice Control, where you can naturally speak your Swift code to Xcode, and it understands the Swift syntax as you speak. To see it in action, take a look at the demonstration in What’s new in Xcode 26. We have a software advisory council that is very sensitive to having our private information going to the cloud in any form. What information do you have to help me guide Xcode and Apple Intelligence through the acceptance process? One thing you can do is configure a proxy for your enterprise that implementing the popular Chat Completions API endpoint protocol. When using a model provider via URL, you can use your proxy endpoint to inspect the network traffic for anything that you do not want sent outside of your enterprise, and then forward the traffic through the proxy to your chosen model provider. Are there list of recommended LLMs to use with Xcode via Intelligence/Local? I've tried Gemma3-12B, but.. I hope there are better options? Apple doesn't have a published list of recommended local models. This is a fast-moving space, and so a recommendation would become out of date very quickly as new models are released. We encourage you to try out the local model support in Xcode 26 with models that you find meet your needs, and let us and the community know! (continued below)
1
0
985
Jul ’25
Help, I'm New and Lot
Hello, I created a code in Xcode on my Mac. Once it was debugged I tried to run it on a simulator. Every time I run it on a simulator I get the white screen with the spinning red box. I'm very new at this and I am creating this app for my own child. As a teacher I couldn't stand the other math fact apps. You'll have to talk to me like an infant.
1
0
62
15h
String Catalog stops updating upon changing source code
If you add a new string in your app (for example String(localized: "contact_support_message", defaultValue: "Please contact support")), then later you change that default value and rebuild, the string catalog updates to match as expected. But once that string is translated, changing the default value in code and rebuilding does not update the catalog. You seemingly have to go manually change the default value for English in the catalog to match the code (which marks the translation as Needs Review). Is there a better way? Or is there a way to determine what strings have default values in code that do not match the catalog values to see if any were missed as wording was tweaked over time?
2
0
101
2d
Host Card Emulation (HCE) not valid
Provisioning profile doesn't match the entitlements file's value for the com.apple.developer.nfc.hce.iso7816.select-identifier-prefixes entitlement. Although when we created the request, we added a list of AIDs which is the same as the list registered in Inof.plist <key>com.apple.developer.nfc.hce.iso7816.select-identifier-prefixes</key> <array> <string>XXXXXX</string> <string>XXXXXX</string> <string>XXXXXX</string> </array> How can we get a better message of diffs between them?
1
0
87
2d
Application Hangs with Nested LazyVStack When Accessibility Inspector is Active
Description I've encountered a consistent hang/freeze issue in SwiftUI applications when using nested LazyVStack containers with Accessibility Inspector (simulator) or VoiceOver (physical device) enabled. The application becomes completely unresponsive and must be force-quit. Importantly, this hang occurs in a minimal SwiftUI project with no third-party dependencies, suggesting this is a framework-level issue with the interaction between SwiftUI's lazy view lifecycle and the accessibility system. Reproduction Steps I've created a minimal reproduction project available here: https://github.com/pendo-io/SwiftUI_Hang_Reproduction To Reproduce: Create a SwiftUI view with the following nested LazyVStack structure: struct NestedLazyVStackView: View { @State private var outerSections: [Int] = [] @State private var innerRows: [Int: [Int]] = [:] var body: some View { ScrollView { LazyVStack(alignment: .leading, spacing: 24) { ForEach(outerSections, id: \.self) { section in VStack(alignment: .leading, spacing: 8) { Text("Section #\(section)") // Nested LazyVStack LazyVStack(alignment: .leading, spacing: 2) { ForEach(innerRows[section] ?? [], id: \.self) { row in Text("Section #\(section) - Row #\(row)") .onAppear { // Load more data when row appears loadMoreInner(section: section) } } } } .onAppear { // Load more sections when section appears loadMoreOuter() } } } } } } Enable Accessibility Inspector in iOS Simulator: Xcode → Open Developer Tool → Accessibility Inspector Select your running simulator Enable Inspection mode (eye icon) Navigate to the view and start scrolling Result: The application hangs and becomes unresponsive within a few seconds of scrolling Expected Behavior The application should remain responsive when Accessibility Inspector or VoiceOver is enabled, allowing users to scroll through nested lazy containers without freezing. Actual Behavior The application freezes/hangs completely CPU usage may spike The app must be force-quit to recover The hang occurs consistently and is reproducible Workaround 1: Replace inner LazyVStack with VStack LazyVStack { ForEach(...) { section in VStack { // ← Changed from LazyVStack ForEach(...) { row in ... } } } } Workaround 2: Embed in TabView TabView { NavigationStack { NestedLazyVStackView() // ← Same nested structure, but no hang } .tabItem { ... } } Interestingly, wrapping the entire navigation stack in a TabView prevents the hang entirely, even with the nested LazyVStack structure intact. Questions for Apple Is there a known issue with nested LazyVStack containers and accessibility traversal? Why does wrapping the view in a TabView prevent the hang? Are there recommended patterns for using nested lazy containers with accessibility support? Is this a timing issue, a deadlock, or an infinite loop in the accessibility system? Why that happens? Reproduction Project A complete, minimal reproduction project is available at: https://github.com/pendo-io/SwiftUI_Hang_Reproduction
0
0
55
2d
Team “57AWJ345M2” cannot enable iCloud Key-Value Storage for Bundle ID “com.marsgame.fg2”
When using Team “57AWJ345M2” and setting the project’s Bundle ID to “com.marsgame.fg2”, enabling the iCloud capability and checking Key-Value Storage results in the following error:"Provisioning profile "iOS Team Provisioning Profile: com.marsgame.fg2" doesn't match the entitlements file's value for the com.apple.developer.ubiquity-kvstore-identifier entitlement." This issue does not occur if we use a different Team or a different Bundle ID. The project was transferred from another Team to this new Team, and everything worked fine before the transfer. Additionally, we have tried creating a brand new project, but as long as we use this same Team and this same Bundle ID, the error still occurs when enabling Key-Value Storage.
4
0
131
3d
XcodePreviews cleared actual app data
I've been developing an advanced gps tracking tool and had over 500 miles of data collected in the local storage of my test app. Recently, I used the XcodePreviews app to use my device to test UI updates as I was making them. To my surprise, doing this cleared all the data from my actual test app. Has this happened to anyone else before? Is there a way to recover my lost data? Why does this happen? I've verified that this is always clearing my app data. I tested by adding data to my actual test app then launching XcodePreviews - only to find that my app data has been cleared.
0
0
17
3d
Appkit without storyboards XCode 26.2
I’m running macOS 15.7 with Xcode 26.2, and I’m trying to learn the basics of AppKit. I’m fully aware that AppKit is considered a legacy / “old” technology and that Apple clearly does not promote it out of the box anymore. This is especially visible in recent versions of Xcode, where you can no longer create a macOS App template without Storyboards or SwiftUI. That said, AppKit is still widely used under the hood, so I think it’s reasonable to at least understand its fundamentals. Here’s the problem I’m facing. I create a standard macOS App project using the Xcode template (AppKit App Delegate). Then I: delete Main.storyboard remove all storyboard references from Info.plist try to create the window manually in applicationDidFinishLaunching At this point, the project builds, but the app either: does not show any window, or behaves as if it were not a proper GUI app While debugging, it looks like Xcode / Swift is treating my target more like a dylib / wrapper than a normal .app bundle (at least judging by runtime behavior and the lack of a proper AppKit lifecycle). While searching for answers, I found this article: https://ashidiqi.com/blog/how-to-setup-xcode-project-programmatically-with-appkit/ The author claims that in this scenario you must not use the @main attribute and instead need a main.swift file that manually calls NSApplicationMain. However, the article also mentions that Xcode shows the error: 'main' attribute cannot be used in a module that contains top-level code The confusing part is that I do not have any top-level code in my project when using @main. At the same time, when I ask an LLM for clarification, it tells me that: @main does not require a storyboard removing a storyboard does not force you to switch to main.swift @main should work fine for a fully programmatic AppKit app So I’m left with two concrete questions: What is the correct, modern answer here? When building a fully programmatic AppKit app (no storyboard, no SwiftUI), do you actually need main.swift, or is @main still fully supported and correct? Is there any supported or recommended way in modern Xcode to get a “clean” AppKit app template without a storyboard? Either via project settings, templates, or some documented workflow — without having to fight the build system or end up with a half-broken target. I’m not trying to fight Apple’s direction here — I just want to understand the correct way to work with AppKit in 2025, even if it’s not the preferred path anymore. Thanks in advance for any clarification.
2
0
116
4d
iMessages App Capability Issue with In-App Purchase
**The issue - ** I can't add "In-App Purchase" as a capability in xCode to my iMessage extension target. **What I have tried - ** I have a valid provisioning profile with In-App Purchases enabled. I have agreed to all agreements in the apple developer console. I have an apple developer membership. I have added an active bank account to my apple developer account. **How the issue came to be - ** I am trying to develop a "stand-alone" iMessage app (no underlying app) which as I understand it is different from a "iMessage extension app"(this has an underlying app that it syncs/interacts with). To do this, I updated my mac to latest OS (Tahoe 26.2) and xCode as well. I then began by using the "iMessage App" template in xCode. And BAM right off the bat, I could not get the "In-App Purchases" capability to show up when I select my iMessage extension target. To be clear, when you make the template, you get 2 targets, one is just a regular "app" target and the other is the iMessage extension target. Now I am not sure if I even need the "app" target if I'm trying for a standalone iMessage app, but I figured it wouldn't be causing this issue as I have tried deleting that target and nothing changed. **Replicating the issue - ** I have tried creating other "iMessage App"'s off of the template to see if maybe I just got it wrong or misconfigured something in my development, but it seems like when you start one of those templates, you immediately are not able to see the "In-App Purchase" capability. **Help! - ** I know this to be possible as there is another (very popular) iMessage extension out on the app store right now called "Game Pigeon" which is also provided by an individual just like I am trying to do, and he uses In App Purchases in his iMessage app. Any help on this would be GREATLY appreciated. Please reach out to me if you need/want additional info or could/want to schedule a meeting.
4
0
117
4d
MetalToolchain download fails on macOS 26.2, build 17C48 catalog error
Without this, I can't install/open Unreal Engine on my iMac OS 26.2 Tahoe. I can't even download the Metal Toolchain in Xcode-Settings-Components. It fails every time. when I try to open Unreal Engine, it says this: Xcode Metal Compiler error: error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain But every time I try to download Metal Toolchain in terminal, it says this: xcodebuild: error: Failed fetching catalog for assetType (com.apple.MobileAsset.MetalToolchain), serverParameters ({ RequestedBuild = 17C48; }) % sudo xcode-select --reset xcrun -f metallib Password: xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find metallib 2> /dev/null' failed with exit code 17664: (null) (errno=No such file or directory) xcrun: error: unable to find utility "metallib", not a developer tool or in PATH
1
0
87
5d
`import Collections` does make no sense errors.
I downloaded package, I can see it in Package Dependencies tab, [swift-collections | https://github.com/apple/swift-collections.git | Up to Next Major Version] — looks OK. But (quite strange): import Collections //🛑 No such module 'Collections' typealias Objects = OrderedSet<anyHashable> // No error I took Collection word from a list or typed — no difference. if I remove import Collections there is no OrderedSet anymore (of course) Can't compile. Cleaned build folder, restarted Xcode... What could be wrong with it? Any ideas?
1
0
16
5d
Cannot open or save a new project in Xcode
I am trying to create a new Xcode project. I am unable to open or create a new project, and am getting the error message "You don't have permission to save the file... in the folder..." and "Authentication failed because the credentials were rejected". I have confirmed I am signed in with the correct Apple ID. I have also confirmed through Xcode account settings, my account is in my organisation team, and I have an Apple Development Certificate and an Apple Distribution Certificate, both created 20/11/2025 (no status listed for either). Could someone please help?
0
0
10
5d
QR code scan deeplink not work in XCode test run?
Hi, I'm trying to figure out what is true here - if I am not in the correct forum please direct me :-) A. It is not possible to test a QR code scan that contains a deeplink into my iOS app from an XCoode build test run. In other words, The build must be published to Test Flight for the iOS's QR code scan sub-system to be able to process the deeplink into my app? If I am wrong about this, it sure would help with testing to be able to test directly from the local XCode build test. If so, can someone point me in the direction of what I would need to do for that? Thanks for your input either way!
0
0
71
5d
In-App Provisioning
I'm implementing the in app provisioning in a financial project. I got my entitlement identifier, I'm also implementing the wallet extension but I have the problem with Xcode. Domain: IXUserPresentableErrorDomain Code: 1 ... NSExtensionPointIdentifier key in the NSExtension dictionary in its Info.plist that does not correspond to a known extension point. But I'm not sure what does this mean, I reviewed the info.plist form the project and the wallet extension
4
0
85
6d
Xcode crashing in live view
I'm new to Xcode. I just downloaded version 26.2 and I'm working on an iMac with macOS Sequoia 15.7.3. I'm created a playground with some very simple code and it crashes when I click live view. I tried looking all over online for a solution and nothing has worked. I tried uninstalling and reinstalling Xcode and still have the same problem. When running the code with the console open I do see the following error. objc[19786]: Class _TtC16AppIntentSchemas16AppIntentDomains is implemented in both /System/Library/PrivateFrameworks/AppIntentSchemas.framework/Versions/A/AppIntentSchemas (0x2840a4c28) and /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/AppIntentSchemas.framework/Versions/A/AppIntentSchemas (0x3276359e8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed. I went to the first folder mentioned in the error /System/Library/PrivateFrameworks/AppIntentSchemas.framework/Versions/A/AppIntentSchemas but I found no file called AppIntentSchemas. Here is the code I'm trying to run. import UIKit import PlaygroundSupport let view = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) view.backgroundColor = .red UIView.animate(withDuration: 15.0) { view.backgroundColor = .blue } PlaygroundPage.current.liveView = view
2
0
63
6d
XCode26.2 ld: Assertion failed: ((ct == Atom::ContentType::objcConst) || (ct == Atom::ContentType::objcData) || (ct == Atom::ContentType::constData) || (ct == Atom::ContentType::constText)), function ObjCClassReadOnlyDataRef, file Atom.cpp, line 329
Dear Apple engineers: My previous project was successfully compiled using Xcode 16.2. Now, I need to adapt it to Xcode 26. I know that the linker in Xcode 26 has undergone significant changes. So, in the 'Other Linker Flags' configuration of the Build Settings in the project engineering of Xcode 26.2, I deleted '-ld64' and added '-Xlinker -dead_strip -Xlinker -dead_strip -allow_dead_duplicates' to adapt to the new linker of Xcode 26. After the modification, when I compiled my project engineering using Xcode 26.2 compiler, I encountered a new linker error. The error log is attached. Regarding this error, how should we solve it? Thank you. XCode26.2BuildErrorLog.txt
3
0
97
6d
xcodebuild does not retry UI tests with xcode 26.2
I have ios UI tests that are build with command xcodebuild -workspace ... -scheme ... -configuration ... -derivedDataPath ... -destination ... -testPlan ... build-for-testing Then I run them with xcodebuild -destination ... -resultBundlePath ... -parallel-testing-worker-count ... -xctestrun ... test-without-building I also have following settings in testplan "maximumTestRepetitions" : 3, "testRepetitionMode" : "retryOnFailure", With xcode 16.4 tests were retried on failure up to 3 times, but migrating to xcode 26.2 seems to change this behavior and tests are no longer retried. Is it expected behaviour and I should manually add params like -test-iterations 3 -retry-tests-on-failure into xcodebuild test-without-building command? Here is xcresult - https://drive.google.com/file/d/1xHgiZnIK_lptDSUf-fCyEnT9zYubZlCf/view?usp=sharing And testrun file -https://drive.google.com/file/d/1aBi2sTjy8zFYtgYn1KA60T8gwD_OnBCF/view?usp=sharing
1
0
140
1w
Liquid glass segment view freezes when dragging handle to a disabled segment
Setup: I have a segment view with 3 segments, and the last on (at index 2) is disabled. Issue: When I drag the liquid glass handle of the segment view from what was previously selected to the disabled segment, the liquid glass handle freezes mid-air. Workaround: I can still interact with the handle and manually restore its position, or tap on any other segment to restore its position. Notes: I'm using UIKit, and no extra customizations are applied. class ViewController: UIViewController { @IBOutlet weak var segmentView: UISegmentedControl! override func viewDidLoad() { super.viewDidLoad() segmentView.removeAllSegments() let segments = ["Option 1", "Option 2", "Option 3"] for (index, title) in segments.enumerated() { segmentView.insertSegment(withTitle: title, at: index, animated: false) } // Select the first one by default segmentView.selectedSegmentIndex = 0 // Disable the last segment segmentView.setEnabled(false, forSegmentAt: 2) } }
0
0
51
1w