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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

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
623
Jul ’25
Where can I manually get device token for APNs online tool?
For testing, I'm trying to "manually" send a push notification to my app using Apple's tool at https://icloud.developer.apple.com/dashboard/notifications/ ... , and I can't figure out where to get the required device token without writing a program to do so. Is there somewhere in Xcode or on https://developer.apple.com where I can copy it from? I already have the .p8 file with APNs enabled, and have set the "remote notifications" capability for the app in Xcode. I must be missing something obvious. I've read a bunch of search results and all they cover is how to get the token programmatically. The device token must be available somewhere, right?
0
0
14
2h
Auto-renewable subscriptions not loading in React Native app after App Store approval when testing via Xcode
Hello, I’m facing an issue with auto-renewable subscriptions in my React Native iOS app using react-native-iap. Before App Store approval, everything worked perfectly — I could test in-app purchases and subscriptions locally on my iPhone through Xcode using a development build and sandbox tester. After the app was approved and released on the App Store, I needed to make some updates. Now, when I build and run the same project again through Xcode (Debug, development-signed) on my iPhone, the subscriptions no longer load. The same product IDs are approved and live in App Store Connect. The live version on the App Store works fine (subscriptions load and process successfully). But on the local Xcode build, getSubscriptions() returns invalid product identifiers or an empty list. No changes were made to the bundle ID or product IDs The build is signed with an Apple Development certificate and uses the same team and bundle identifier as the published app. “In-App Purchase” capability is enabled. I’ve also tried deleting the app, rebooting the device, and re-logging into a sandbox tester account, but the issue persists. It looks like the sandbox environment no longer works for the app after its first App Store release. Has anyone experienced this issue where the same approved app’s IAPs work in production but fail to load in sandbox/dev builds through Xcode after release? Any guidance on re-enabling sandbox testing for updates would be greatly appreciated. Environment: Xcode 26.0.1 React Native with react-native-iap Auto-renewable subscriptions (3 SKUs) Thank you!
0
0
43
9h
Connect Apple Watch to Xcode.
How to connect Apple Watch to Xcode? I haven't used Apple Watch for ages but it used to work fine. Today after adding changes to one of my apps Watch extension I wanted to test it on my Apple Watch but I'm not able to get Xcode to discover my Apple Watch. Apple watch has both Bluetooth and Wifi on. It's connected to the same Wifi as my Mac mini. Watch is paired with iPhone and the iPhone is connected to Mac mini via USB cable. Deploying to iPhone works fine, but I Xcode doesn't see as Apple Watch. iPhone sees Apple Watch. I tried Xcode 16.2, and Xcode 26.0 and Xcode Version 26.1 beta 2. I updated Apple Watch to Watch OS 26 but it didn't help. iPhone 12 Pro Max, iOS 26.0 Apple Watch Series 8 (GPS), watchOS 26.0.2 Mac mini 2025, Apple M4 Pro, macOS 15.6 Please advise. It's so frustrating! I wasted 2 hours on that already. In the past (years ago) I used to manage 3 apps with Apple Watch extensions and connection were finicky but it wasn't so bad!
1
0
99
23h
Methods for dealing with macOS Wallpaper Cache
Hello, Back in January 2024, I filed a bug report regarding a cache being kept by the macOS Wallpaper Agent. This cache contains every image ever set as a users wallpaper, and at the time the issue was reported, it never cleared, leaving hundreds of gigabytes wasted on users disks in some cases. FB13536275 This issue was ultimately fixed in macOS 15.1 beta 6, and remained fixed for the duration of macOS 15. The fix was excellent - the cache was reduced to storing just 2-3 days worth of images. Sadly, we've discovered that this issue is back in macOS Tahoe. The cache has moved locations, and once again is not clearing. We have filed this bug again, less than a year after it was first fixed: FB20636593 We develop an app called 24 Hour Wallpaper that keeps the wallpaper in sync with the time of day. This necessitates that the app regularly changes the wallpaper, which sadly now results in an infinitely growing and useless cache of BMP files generated by the system. As we waited 10 months for this to get fixed the first time, we expect to wait at least that long to get it fixed again, and have no confidence that it will stay fixed because the last fix lasted less than a year. This leaves us in a bad position, as people can't use our app without the cache growing arbitrarily and ultimately completely filling their disk. We've already had customers call Apple to complain about this, and the good news is that the support agents understand that this is a problem with macOS, not with our app. What we've decided to do is add a feature to the app that monitors the size of this cache and periodically deletes it. We're required to get the users permission the first time to do this, but after that the permission is cached, so the app can keep the cache folder clean regardless of if macOS is doing it's job or not. We haven't seen any side effects or problems as a result of doing this. We've seen other apps like CleanMyMac do this without any problems. We're wondering if there is anything we should be aware of regarding this caches behavior before releasing this flushing feature. Thanks for your time, -josh
0
0
89
1d
Xcode
I just had WindowServer crash. Xcode stopped working shortly after that. I tried restarting Xcode 26.0.1 universal but it refused. I rebooted macOS 26.0.1 Tahoe and tried to start the same Xcode, no joy. I tried...six different already installed Xcodes, all displaying the "Xcode_26.1b quit unexpectedly." alert. Looking at the report: Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid)) Exception Subtype: UNKNOWN_0x32 at 0x00000001111e4000 Exception Codes: 0x0000000000000032, 0x00000001111e4000 Termination Reason: Namespace CODESIGNING, Code 2, Invalid Page This seems wild to me. Thanks! -Mike
0
0
38
1d
Xcode 26 Compiler Critical Issues?
Hello everyone, Since I installed Xcode 26, I've been encountering issues I've never seen before. I have Mac OS applications written in Objective-C, some released as far back as 14 years ago. When compiling them with Xcode 26, I experience efficiency issues related to thread management and interface updates. There are rendering problems with a simple NSTextView created through Interface Builder. The issue is not easily reproducible as it occurs randomly on some machines, regardless of their architecture or macOS version. The main thread freezes, and generally after 15-30 seconds, it unfreezes, loading the interface and text. The length of the text is irrelevant to the issue, and no crashes occur. I spent ten days trying to optimize the code and change the loading order within the class, but the problem persists. However, if I compile the application with Xcode 16.4, everything works like a charm. I also tried using the macOS 15.5 SDK to compile with Xcode 26, but it doesn’t resolve any issues. Additionally, I tried changing the compiler optimization level, but it didn’t solve the problem. This leads me to believe it’s an issue with the Xcode 26 compiler. If it were a code issue, it would be easily reproducible and would also occur when compiling with 16.4. The Xcode 26.1 Beta doesn’t resolve the issue. Can anyone tell me if I need to change something related to the compiler? Are you aware of any issues like this? Thank you, Luca
0
1
56
1d
Debugger Issue After Installing macOS Tahoe 26.0.1
After upgrading to macOS Tahoe 26.0.1, I encountered an issue where the debugger could no longer display standard C++ library types such as std::map, std::string, and other std:: containers. Instead, the debugger simply showed: Summary Unavailable 🧪 What I Tried • Switched from the default LLVM compiler to GDB to check if it was a debugger-related problem — no improvement. • Cleaned and rebuilt the project — the issue persisted. ✅ Solution Downgrading Xcode to version 16.4 immediately resolved the issue. According to Apple’s official Xcode support documentation, Xcode 16.4 is compatible with macOS Sequoia 15.6 and later, which includes macOS Tahoe 26.0.1. This suggests that the problem may be caused by a compatibility issue in the latest Command Line Tools bundled with newer versions of Xcode. 💡 Takeaway If you encounter the same problem: 1. Try downgrading to Xcode 16.4 or reinstalling the corresponding Command Line Tools. 2. Make sure your debugger (LLDB or GDB) is correctly linked to the appropriate SDK version. Hopefully this helps anyone experiencing the same issue!
0
0
49
1d
[Beginner] Unsure if I need Foundation import, and how to auto-import it
I'm working in Xcode for the first time in over a decade (coming from VS Code and Zed), so bear with me on this one. I've just started up a new project and got things running, and I'm adding the following struct to my project: struct HttpRequest: Codable { let body: String? let headers: [String: String] let id: UUID let method: HttpMethod let url: String } The UUID type is from Foundation, of course. However, when I hit Ctrl+Space to auto-complete it, it says "Foundation is not imported." If I hit enter to select that entry, it does not auto-import Foundation, and gives me an error that it "Cannot find type 'UUID' in scope". I can click that error and it then click "import Foundation" to add the import, but this seems like a lot of effort just to "automatically" add an import that Xcode is already aware I need to add. On the other hand, I found a number of threads online during my search for answers that suggested I shouldn't even need this import, despite Xcode's insistence. TL;DR, my questions are: 1) Do I need the Foundation import to use UUID in Swift? and 2) If I do need it, how can I auto-import the Foundation module when I auto-complete the UUID type?
3
0
95
9h
RoomPlan CaptureError.exceedSceneSizeLimit on iOS devices
When scanning multiple rooms (10+) in a single structure using ARWorldMap for coordinate space consistency, RoomCaptureSession throws CaptureError.exceedSceneSizeLimit. The instructions here (https://developer.apple.com/documentation/roomplan/scanning-the-rooms-of-a-single-structure) provide exactly what I am doing to keep the underlying ARSession alive (by calling captureSession.stop(pause: false)) and save the results before a user moves to the next room. Scanning 11 or so rooms will cause the user to hit the exceedSceneSizeLimit error. The ARWorldMap is about 58 MB and always is around this size when hitting this issue. No anchors are present and all the data seems to be from tracking data. On iPad devices (where I do not see this issue) the ARWorldMap grows as a significantly slower rate in size. I save the ARWorldMap after each room is scanned and confirmed by the user. If I use the ARMap to initialize the ARSession (as described in the docs) the session will immediately error with "exceedSceneSizeLimit" once the captureSession.run() is executed. Occasionally it will allow me/the user to scan again, but either breaks mid scan or the following. This has been working fine for the past 2 years and users have been able to scan dozens of rooms without issue. It seems only lately that it has been a problem. I would expect the ARWorldMap to be allowed for much bigger sizes. At this point I can just about scan more area of my house with a single scan than I can when I use different captureSessions. Few observations: This happens on my iPhone 15 Pro Max, my iPhone 17 Pro, but not my iPad M4 (maybe memory related?). It is possible if scanning many more rooms it would happen on the iPad too. I have tried things such as resetting the ARConfig on the underlying ARSession to reset some, but this doesn't work. I have tried to create a new ARWorldMap and move the origin to the older map to clear out tracking data. This almost works but causes a mess of issues when a user moves at all due to the unshared coordinate space. I believe there are three active issues regarding this: FB14454922, FB15035788, FB20642944 Could we get an update for this issue? It is a production issue and severely limits my user experience in my production application.
0
0
33
2d
Impossible to connect iPhone 7 (iOS 15.8) with xCode 26
I have spent nearly an hour trying to get my iPhone 7 with iOS 15.8 to be recognized within xCode 26. I did not have this issue with the previous version of xCode. I have tried rebooting my Mac, rebooting my iPhone 7, removing the iPhone 7 from the list of devices that belong to my account, verified that I have support files for iOS 15.8 installed, signing out of my Apple account and signing back in....nothing works. Every time I go to "Windows > Devices" I see the iPhone 7, but I get a never-ending spinning circle next to the iPhone 7 (which is shown as connected) along with a banner that says "xCode will continue when Joe's iPhone 7 is finished." I can leave the phone connected to my Mac for an hour, and this message and the spinning circle next to the iPhone 7 never changes.
2
0
83
2d
IOS Development Certificates are being created under the incorrect Team ID
I am experiencing a critical issue with the IOS Development Portal where certificates are being created under the incorrect Team ID despite being logged into the correct team context. in the Portal also in Xcode. I am logged into the Apple Developer Portal under "Company LLC (Team ID: 12345678)" However, when creating "Apple Development" certificates through the portal, they are being assigned Team ID "987654321" (my personal developer account) This occurs even when explicitly creating certificates from within the Company LLC team context. Also the same if i create the IOS Development in Xcode as well. This is preventing me from Archive my app in Xcode so i can upload the new version in the App Store. Please Help. Thank you in advance.
0
0
19
2d
IOS Development Certificates are being created under the incorrect Team ID
I am experiencing a critical issue with the Apple Developer Portal where certificates are being created under the incorrect Team ID despite being logged into the correct team context. I am logged into the Apple Developer Portal under "Company LLC (Team ID: 12345678)" However, when creating "Apple Development" certificates through the portal, they are being assigned Team ID "987654321" (my personal developer account) This occurs even when explicitly creating certificates from within the Company LLC team context. The same is happening if I tried to create the IOS Development Certificate in Xcode, same issue, creates the certificate with the wrong Team ID This is preventing me from Archive my app in Xcode so i can upload the new version of my App in the App Store. Please Help. Thank you in advance
0
0
57
2d
PhotosUI does not build with UIKit and WidgetKit in XCode26
To reproduce this bug create a new Xcode Project for IOS choose UIKit. In the app delegate add the following lines. As you can see in the above image . Line 19 with the initialization of PHPickerViewController has no compilation failure. Now lets add import WidgetKit As soon as widgetKit is imported a compiler error is thrown which is PHPickerViewController is not in scope. This worked with Xcode 16.4 It was possible to have a swift file with both WidgetKit implementations and PhotosUI implementations. This behavior has changed in Xcode 26/26.0.1 . Does anybody know why this happens , could not find any clues within the different versions of documentations. P.S Found a work around which raises further questions Adding import SwiftUI fixes this problem , I am genuinely curious on how this is happening on a compiler level. LINKS To my previously published post :https://developer.apple.com/forums/thread/804059
0
3
64
3d
Xcode 26 Stable Build Interruptions
I have a mac mini on OS 15.7 ( Sequoia ) with 4-5 iPhone and iPad devices on version iOS 26.0 Stable connected to it. I am trying to build a device farm application where it run multiple UI tests to restore the device state but facing BUILD INTERRUPT intermittently during the UI test run. What can be the issue here? Is it device side issue OR issue with device and xcode connection. What tools can I use to gather more information of xcode and its processes or memory leaks due to it. Could any network call interruption via xcode can lead to this issue.
0
0
39
3d
How to debug ios Webkit crash
We have an iphone app that has an embedded webview using webkit, and we found the app crashes when we navigate to an specifc internal website. When I opened the ips file I see this stacktrace on the com.apple.main-thread WebCore::JSDOMRect::subspaceForImpl(JSC::VM&) WebCore::JSDOMRect::create(JSC::Structure*, WebCore::JSDOMGlobalObject*, WTF::Ref<WebCore::DOMRect, WTF::RawPtrTraits<WebCore::DOMRect>, WTF::DefaultRefDerefTraits<WebCore::DOMRect>>&&) WebCore::toJSNewlyCreated(JSC::JSGlobalObject*, WebCore::JSDOMGlobalObject*, WTF::Ref<WebCore::DOMRect, WTF::RawPtrTraits<WebCore::DOMRect>, WTF::DefaultRefDerefTraits<WebCore::DOMRect>>&&) JSC::JSValue WebCore::CloneDeserializer::readDOMRect<WebCore::DOMRect>() WebCore::CloneDeserializer::readTerminal() WebCore::CloneDeserializer::deserialize() WebCore::SerializedScriptValue::deserialize(JSC::JSGlobalObject&, JSC::JSGlobalObject*, WTF::Vector<WTF::Ref<WebCore::MessagePort, WTF::RawPtrTraits<WebCore::MessagePort>, WTF::DefaultRefDerefTrait WebCore::SerializedScriptValue::deserialize(JSC::JSGlobalObject&, JSC::JSGlobalObject*, WebCore::SerializationErrorMode, bool*) WebCore::SerializedScriptValue::deserialize(OpaqueJSContext const*, OpaqueJSValue const**) API::SerializedScriptValue::deserialize(WebCore::SerializedScriptValue&) ScriptMessageHandlerDelegate::didPostMessage(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, API::ContentWorld&, WebCore::SerializedScriptValue&) WebKit::WebUserContentControllerProxy::didPostMessage(WTF::ObjectIdentifierGeneric<WebKit::WebPageProxyIdentifierType, WTF::ObjectIdentifierMainThreadAccessTraits<unsigned long long>, unsigned lon WebKit::WebUserContentControllerProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) WebKit::WebProcessProxy::dispatchMessage(IPC::Connection&, IPC::Decoder&) WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) IPC::Connection::dispatchMessage(WTF::UniqueRef<IPC::Decoder>) IPC::Connection::dispatchIncomingMessages() WTF::RunLoop::performWork() WTF::RunLoop::performWork(void*) __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ __CFRunLoopDoSource0 __CFRunLoopDoSources0 __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal -[UIApplication _run] UIApplicationMain main start I assume something is crashing after deserializing a JSDomRect. This is crashing on an Iphone 13 with os 18.6.2 but this doesn't crash on iphone 11 os 26.0 I'm executing the app from xcode and I'm not able to see the stacktrace listed before in xcode, to be able to see variables and to understand what is being deserialized. I've also tried using safari mac develop, but safari stops debugging as soon as the app crashes. I've also tried attaching a remote process into the webkit I've downloaded from here https://webkit.org/getting-the-code/ but didn't have luck so far. Do you know how can I debug what's causing the crash?
3
0
65
2d
Unable to provision target
I have added an in-app purchase function into my app, and have enabled in-app purchase profile in developer portal(it's on by default and is marked gray in developer portal, I don't know if that's how it supposed to look like). I have issued the agreements and tried signing the app both manually and automatically, but neither of that worked. App can be built successfully in simulator but does not show the simulation window, but cannot build on real device or archive. Errors: Missing com.apple.developer.in-app-purchase, com.apple.developer.in-app-purchase.non-consumable, and com.apple.developer.in-app-purchase.subscription entitlements. Automatic signing failed Xcode failed to provision this target.
0
0
11
3d
Unable to provision target
I have added an in-app purchase function into my app, and have enabled in-app purchase profile in developer portal(it's on by default and is marked gray in developer portal, I don't know if that's how it supposed to look like). I have issued the agreements and tried signing the app both manually and automatically, but neither of that worked. App can be built successfully in simulator but does not show the simulation window, but cannot build on real device or archive. Errors: Missing com.apple.developer.in-app-purchase, com.apple.developer.in-app-purchase.non-consumable, and com.apple.developer.in-app-purchase.subscription entitlements. Automatic signing failed Xcode failed to provision this target.
1
0
36
2d
Present User an error message when SwiftData save fails
Have a data model that sets certain fields as unique. If the user attempts to save a duplicate value, the save fails quietly with no indication to the user that the save failed. The program is on Mac OS 26.0.1 @Environment(\.modelContext) var modelContext @Query private var typeOfContracts: [TypeOfContract] @State private var typeName: String = "" @State private var typeCode: String = "" @State private var typeDescription: String = "" @State private var contracts: [Contract] = [] @State private var errorMessage: String? = "Data Entered" @State private var showAlert: Bool = false var body: some View { Form { Text("Enter New Contract Type") .font(.largeTitle) .foregroundStyle(Color(.green)) .multilineTextAlignment(.center) TextField("Contract Type Name", text: $typeName) .frame(width: 800, height: 40) TextField("Contract Type Code", text: $typeCode) .frame(width: 800, height: 40) Text("Contract Type Description") TextEditor(text: $typeDescription) .frame(width: 800, height: 200) .scrollContentBackground(.hidden) .background(Color.teal) .font(.system(size: 24)) Button(action: { self.saveContractType() }) { Text("Save new contract type") } } } func saveContractType() { let typeOfContract = TypeOfContract(contracts: []) typeOfContract.typeName = typeName typeOfContract.typeCode = typeCode typeOfContract.typeDescription = typeDescription modelContext.insert(typeOfContract) do { try modelContext.save() }catch { errorMessage = "Error saving data: \(error.localizedDescription)" } } } I have tried to set alerts but Xcode tells me that the alerts are not in scope
9
0
144
4h