Structs are value types, and the SwiftUI gets reinitialized many times throughout its lifecycle. Whenever it gets reinitialized, would the reference that the delegator has of it still work if the View uses @State or @StateObject that hold a persistent reference to the views data?
protocol MyDelegate: AnyObject {
func didDoSomething()
}
class Delegator {
weak var delegate: MyDelegate?
func trigger() {
delegate?.didDoSomething()
}
}
struct ContentView: View, MyDelegate {
private let delegator = Delegator()
@State counter = 1
var body: some View {
VStack {
Text("\(counter)")
Button("Trigger") {
delegator.trigger()
}
}
}
func didDoSomething() {
counter += 1 //would this call update the counter in the view even if the view's instance is copied over to the delegator?
}
}
Overview
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello All,
I am new to apple ecosystem. We have a xcode project whose code is scattered across different repos. We are trying setup CI/CD for this Xcode project to get build so that we could know build issue.
Clone/Update all repos – which I can do via some script
Generate xcode projects from sources synced in step 1. This is where we want your help. How should we approach this? What apple suggest for this ? In this step we don't want to use any third part tool (like CMake) to generate Xcode projects.
Build targets to know build errors – This we can easily do via xcodebuild command line tool.
Please share you input/thought on this. Your input is highly appreciated.
I was encountering visual artifacts in my Unity game only on iOS devices and wanted to use the Metal Debugger to diagnose it. However, it seems to only capture static noise which is not helpful as shown below
For reference, this is a frame of the visual artifact and also the location where I asked Metal to capture the frame
Am I missing any settings in Unity/Xcode?
Hi DF
I'm working on a watchOS app with an iOS companion app and have been updating the minimum deployments for both.
After making the updates, when I upload the apps to TestFlight or App Store, the compatibility field for the watchOS has been removed.
Instead of saying:
Compatibility:
Requires iOS 15.6 or later...
Requries watchOS 10.6 or later...
It says:
Requires macOS...
Requires iOS 15.6 or later...
It is not a macOS app, so I don't know why that is displayed.
How do I remove macOS and get it to display watchOS min requirement?
Hi All,
In continuation of this thread https://developer.apple.com/forums/thread/804439
I want to perform data upload after getting it from the BLE device. As state restoration wake should not deal with data upload i though of using a processing task to perform the data upload.
So the flow will be something like:
Connect to device -> listen to notification -> go to background -> wake from notification -> handle data download from ble device -> register processing task for data upload -> hopefully get the data uploaded
From reading about processing task i understand that the task execution is completely handled by the OS and depends on user behaviour and app usage. I even saw that if the user is not using the app for a while, the OS might not even perfoirm the task. So my quesiton is: does state restoration wakeup and perfroming data dowloads in the backgound considered app usage that will increase the likeluhood the task will get execution time?
Can we rely on this for a scenario that the user opens the app for the first time, register, onboard for ble, connect to devie and then put it in the background for days or weeks and only relying on state restoration and processing tasks to do their thing?
Sorry for the long read and appreciate your support!
Shimon
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
Background Tasks
Core Bluetooth
Hello!
I’m building my Swift Student Challenge project in Swift Playgrounds, and I’ve run into an issue with app orientation.
Since this is a game, the layout and interactions only work correctly in landscape, but Playgrounds doesn’t offer the usual orientation settings you’d configure in Xcode.
Is there a recommended way to force a landscape-only experience in Swift Playgrounds using SwiftUI? Any workarounds or guidance would be greatly appreciated!
Thank you!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Swift Student Challenge
Swift Playground
Playground Support
SwiftUI
I exported some usd assets from IsaacSim but they are not showing up correctly on my Apple Vision Pro.
Even though the mesh looks to be the correct color in Finder and I can see the Diffuse Color looks correct, the object is still just gray. It should be green!
Cybersource production support has clarified issue as below
"On the BAD Case, it seems that the Apple Payload did not contain the "onlinePaymentCryptogram" object within the JSON. The Cryptogram is critical and mandatory.
Since the merchant cannot really control this, and since CYBS is just decrypting the payload and uses it, we cannot comment as to why it was missing.
The merchant would need to reach out to Apple and/or decrypt the payment themselves locally to check if and why this data was not present, for troubleshooting purposes."
Our iOS app supports CarPlay capability with the Driving task.
The app is also configured to wake in the background on geofence entry or exit events, even from a terminated (killed) state.
We would like to understand how to detect whether CarPlay is connected to the iPhone when the app wakes up or runs in the background.
In this case, the CarPlay app is not actively running in the Car infotainment system foreground.
Requirement:
The app should perform a background task only when CarPlay is connected, including when launched in the background or from a killed state due to a geofence trigger.
Could you please advise on the recommended way or API to determine CarPlay connection status in this background scenario?
Thanks for the support!
I'm getting the following error when I try to make a dev build for iOS even though I am an admin:
✖ Failed to register bundle identifier
Apple 403 detected - Access forbidden.
This request is forbidden for security reasons - You currently don't have access to this membership resource.
Not certain how to proceed from here
Hi All,
I am building my own MDM server. It seems that in order for the MDM commands to function an MDM Push Certificate for the APNS framework. And in order to get the MDM Push Certificate from the Apple Push Certificates Portal (https://identity.apple.com/pushcert/) you need to upload your CSR usually provided and sign by the MDM Vendor of your choosing. I am familiar with this process.
But now that I am the MDM Vendor, I am not sure where to get this MDM Vendor CSR Signing Certificate.
I've already submitted a formal request via the "contact us" form. Apple's response pointed me to the documentation on Setting Up Push Notifications and the MDM Vendor CSR Signing Certificate help page (which I had already reviewed):
https://developer.apple.com/documentation/devicemanagement/setting-up-push-notifications-for-your-mdm-customers
https://developer.apple.com/help/account/certificates/mdm-vendor-csr-signing-certificate/
The issue is that these documents describe using the signing certificate, but not the process for obtaining it as a new, independent vendor.
So does anyone know of a portal or method of generating this “MDM Vendor Certificate”?
or maybe I'm going about this all wrong and there is a simpler way… the again, its apple, so I’m probably on the right path just beed a little direction please. (I am not sure where to get this MDM Vendor CSR Signing Certificate.)
My Xcode crashed over and over again while I searing spefic file like "TingMusic". I have tried uninstall and install Xcode from 16.0 to 16.4, clear derived data folder, reboot my Mac, but none of these working. 😭
Translated Report (Full Report Below)
Process: Xcode [1811]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 16.4 (23792)
Build Info: IDEApplication-23792000000000000~2 (16F6)
App Item ID: 497799835
App External ID: 874973124
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2025-09-02 10:51:26.8582 +0800
OS Version: macOS 15.6 (24G84)
Report Version: 12
Anonymous UUID: 9835064A-AD7C-EE47-64DE-49587A7EC956
Time Awake Since Boot: 320 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [1811]
Application Specific Information:
abort() called
Application Specific Signatures:
isSameDocumentAsURL
Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x186d5e388 __pthread_kill + 8
1 libsystem_pthread.dylib 0x186d9788c pthread_kill + 296
2 libsystem_c.dylib 0x186ca0a3c abort + 124
3 IDEKit 0x10890d888 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 964
4 IDEKit 0x10890dcf8 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 872
5 DVTFoundation 0x1047839a0 _DVTAssertionHandler + 412
6 DVTFoundation 0x104783b04 _DVTAssertionFailureHandler + 196
7 IDEKit 0x1086e5178 -[IDENavigableItemCoordinator _navigableItemForFilePath:inWorkspace:withSeenFileReferences:computedNavItemsByContainerFilePath:allowLeaf:] + 2240
8 IDEKit 0x1086e3d24 -[IDENavigableItemCoordinator _structureNavigableItemForFileURL:inWorkspace:error:] + 268
9 IDEKit 0x1086e4658 -[IDENavigableItemCoordinator structureNavigableItemForDocumentURL:inWorkspace:error:] + 152
10 IDEKit 0x1086e89bc +[IDENavigableItemCoordinator temporaryStructureItemForDocumentURL:forWorkspace:error:inScope:] + 116
11 IDEKit 0x1088689e0 +[IDEOpenQuicklySubpathGenerator subpathForURL:lineNumber:isFromProject:showFileName:fromWorkspace:withAttributes:] + 716
12 IDEKit 0x108869a88 -[IDEOpenQuicklyResult(SubPath) subPathForWorkspace:withAttributes:] + 356
13 IDEKit 0x1088eee54 -[IDEOpenQuicklyResultDisplayRecord subtitle] + 172
14 IDEKit 0x10894bb1c -[IDEOpenQuicklyResult(ViewExtension) cellViewForOutlineView:displayRecord:delegate:] + 596
15 IDEKit 0x108849564 -[IDEQuickSearchWindowController outlineView:viewForTableColumn:item:] + 72
16 AppKit 0x18ae314a8 -[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 176
17 AppKit 0x18ae30c0c -[NSTableRowData _addViewToRowView:atColumn:row:] + 228
18 AppKit 0x18ae2ed5c -[NSTableRowData _initializeRowView:atRow:] + 328
19 AppKit 0x18ae2d8ec -[NSTableRowData _preparedRowViewForRow:storageHandler:] + 140
20 AppKit 0x18ae2d7bc -[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 268
21 AppKit 0x18ae2d5e4 -[NSTableRowData _addRowViewForVisibleRow:] + 316
22 AppKit 0x18ae2cdf0 -[NSTableRowData _updateVisibleRowEntries] + 640
23 AppKit 0x18ae2c854 -[NSTableRowData updateVisibleRowViews] + 612
24 AppKit 0x18ae2bf08 -[NSTableView layout] + 148
25 AppKit 0x18b8d0fa8 ___NSViewLayout_block_invoke + 632
26 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
27 AppKit 0x18adeb8d8 _NSViewLayout + 96
28 AppKit 0x18b8c72cc __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 372
29 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
30 AppKit 0x18adeb86c -[NSView _layoutSubtreeWithOldSize:] + 100
31 AppKit 0x18b8c7410 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 696
32 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
33 AppKit 0x18adeb86c -[NSView _layoutSubtreeWithOldSize:] + 100
34 AppKit 0x18b8c7410 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 696
35 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
36 AppKit 0x18adeb86c -[NSView _layoutSubtreeWithOldSize:] + 100
37 AppKit 0x18b8c7410 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 696
38 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
39 AppKit 0x18adeb86c -[NSView _layoutSubtreeWithOldSize:] + 100
40 AppKit 0x18b8c7410 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 696
41 AppKit 0x18ade7000 NSPerformVisuallyAtomicChange + 108
42 AppKit 0x18adeb86c -[NSView _layoutSubtreeWithOldSize:] + 100
43 AppKit 0x18b8c7410 __36-[NSView _layoutSubtreeWithOldSize:]_block_invoke + 696
As a developer I have a question I would like cleared up. We offer two tiers of annual subscriptions in our apps. These subscriptions are under the same subscription group in App Store connect. My question is, if a user purchases tier 1 of the annual subscription for $10.00, and uses it for 6 months; then chooses to upgrade to tier 2 which costs $20.00 per year. Would the user be pro-rated the difference in price i.e. charge only another $10.00 at the time of the upgrade., or are they charged $20.00 and then refunded the difference in their remaining lower tier subscription? I keep finding inconsistent answers across the Apple community forums on this.
I have a view inside a Swift Package that relies on an external Swift Package. My Preview Canvas breaks as soon as I use code from the external package:
import ComplexModule // From swift-numerics
import SwiftUI
struct MyView: View {
// Commenting out this line will make Previews work
let number: Complex<Double> = 123
var body: some View {
Text("Hello World")
}
}
#Preview {
MyView()
}
This is part of the error the preview emits:
== PREVIEW UPDATE ERROR:
GroupRecordingError
Error encountered during update group #33
==================================
| [Remote] JITError: Runtime linking failure
|
| Additional Link Time Errors:
| Symbols not found: [ _$sSd10RealModule0A0AAMc, _$s13ComplexModule0A0VMn, _$s13ComplexModule0A0V14integerLiteralACyxG07IntegerD4TypeQz_tcfC ]
|
| ==================================
|
| | [Remote] LLVMError
| |
| | LLVMError: LLVMError(description: "Failed to materialize symbols: { (static-MyTarget, { __replacement_tag$1 }) }")
Did anyone else see this before?
When I use my iPhone to scan the apple pay QR code in chrome, the url is https://applepaydemo.apple.com/apple-pay-js-api, I keep geting the "Service Unavailable" error.
Wonder know if you guys meet this error as well? Btw, the QR code feature needs IOS 18.
So I noticed this:
A sheet window is presented.
The sheet window has some UI that makes it expandable say a little arrow expandable button.
Click the little expandable button. Now the sheet window controller calls - (void)setFrame:display:animate: on its window to resize.
The parent window flies across the screen to the lower left corner.
I'm on Tahoe 26.1. Seems to be related to NSSheetMoveHelper. Not sure how long this bug has been around. Workaround is to call -setFrame:display:animate: and pass NO to the animate flag. Then the sheet window resizes (but not animated which doesn't look as good as the old behavior but better than suddenly disappearing).
I think Apple may already knows about this bug b/c in an Apple app on Tahoe I see a sheet resizing being done with no animation...
We used below method to resize image while compress the image,
Below method is correct or need to do the correction in method or "CGBitmapContextCreate"
-(UIImage *)resizeImage:(UIImage *)anImage width:(int)width height:(int)height
{
CGImageRef imageRef = [anImage CGImage];
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
if (alphaInfo == kCGImageAlphaNone)
alphaInfo = kCGImageAlphaNoneSkipLast;
CGContextRef bitmap = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(imageRef), 4 * width, CGImageGetColorSpace(imageRef), alphaInfo);
CGContextDrawImage(bitmap, CGRectMake(0, 0, width, height), imageRef);
CGImageRef ref = CGBitmapContextCreateImage(bitmap);
UIImage *result = [UIImage imageWithCGImage:ref];
CGContextRelease(bitmap);
CGImageRelease(ref);
return result;
}
Hello to all
I have coded in swift a headless app, that launches 3 go microservices and itself. The app listens via unix domain sockets for commands from the microservices and executes different VPN related operations, using the NEVPNManager extension. Because there are certificates and VPN operations, the headless app and two Go microservices must run as root.
The app and microservices run perfectly when I run in Xcode launching the swift app as root. However, I have been trying for some weeks already to modify the application so at startup it requests the password and runs as root or something similar, so all forked apps also run as root. I have not succeeded. I have tried many things, the last one was using SMApp but as the swift app is a headless app and not a CLI command app it can not be embedded. And CLI apps can not get the VPN entitlements. Can anybody please give me some pointers how can I launch the app so it requests the password and runs as root in background or what is the ideal framework here? thank you again.
Hello developers,
atm im developing a small app focused on hiking. A core pice of the app is a Map() from MapKit. I only want a few points of interest to be visible on the map (e.g. no stores, no clubs etc.).
My question now is what modifier includes mountain Peaks? I tried .rockClimbing, .nationalPark, .landmark, .skiing & .hiking. However none of them makes mountain Peaks visible on the map.
The complete code would be:
Map()
.mapStyle(.standard(pointsOfInterest: .including([.rockClimbing, .nationalPark, .landmark, .skiing, .hiking])))
The iOS application is a Central Manager connected to a Bluetooth Low Energy (BLE) accessory that utilizes the Hands-Free Profile (HFP).
When the application plays a notification tone (using AVAudioPlayer or System Sounds), the audio is incorrectly routed to the device's internal speaker instead of the active HFP headset.
How do we programmatically ensure that these notification tones are automatically and reliably routed to the connected HFP headset