Swift is a powerful and intuitive programming language for Apple platforms and beyond.

Posts under Swift tag

200 Posts

Post

Replies

Boosts

Views

Activity

UITabBarAppearance with iOS27 Beta
iOS Version: iOS 27 Beta Xcode: Xcode27 Beta 2 I have a custom UITabBar subclass. The tab bar items are visible and selectable, and the selected state works, but the title color in the normal state is always rendered as white, even though I set a different normal title color. Simplified code let normalColor = UIColor.gray let selectedColor = UIColor.orange let bgColor = UIColor.black let font = UIFont.systemFont(ofSize: 10, weight: .semibold) let appearance = UITabBarAppearance() appearance.configureWithOpaqueBackground() appearance.backgroundEffect = nil appearance.backgroundColor = bgColor appearance.shadowColor = .clear let itemAppearance = appearance.stackedLayoutAppearance itemAppearance.normal.titleTextAttributes = [ .font: font, .foregroundColor: normalColor ] itemAppearance.selected.titleTextAttributes = [ .font: font, .foregroundColor: selectedColor ] itemAppearance.normal.iconColor = normalColor itemAppearance.selected.iconColor = selectedColor appearance.stackedLayoutAppearance = itemAppearance appearance.inlineLayoutAppearance = itemAppearance appearance.compactInlineLayoutAppearance = itemAppearance tabBar.standardAppearance = appearance if #available(iOS 15.0, *) { tabBar.scrollEdgeAppearance = appearance } tabBar.backgroundColor = bgColor tabBar.isTranslucent = false The problem: The selected title/icon color works. The normal title color is ignored and stays white. This happens after moving to the newer tab bar appearance behavior / Liquid Glass environment. Question: Is there any additional configuration required for UITabBarAppearance so that the normal UITabBarItem title color is respected? Could unselectedItemTintColor, tintColor, scrollEdgeAppearance, or Liquid Glass behavior override normal.titleTextAttributes?
4
0
924
4w
Error in Xcode console
Lately I am getting this error. GenerativeModelsAvailability.Parameters: Initialized with invalid language code: en-GB. Expected to receive two-letter ISO 639 code. e.g. 'zh' or 'en'. Falling back to: en Does anyone know what this is and how it can be resolved. The error does not crash the app
5
2
2.1k
Sep ’26
Bundle preferred languages mechanism
Hi there, I’m curious to understand how the system determines which language to use for an app. The system is currently set to en-IN (English - India). My app supports the following languages: en (the default development language) en-GB (United Kingdom) en-IE (Ireland) en-US (United States) When I run the app, the Bundle.main.preferredLanguages returns [„en-GB“, „en“], which causes the app to be set to en-GB. However, when the app doesn’t support the preferred system language, I would expect it to default to the en language. Surprisingly, this is not the case. This behavior is precisely described in Technical Note TN2418. Unfortunately, there’s no explanation provided. Is this behavior related to the CLDR Linguistic Distance? I also attempted to replace the default development language en with en-001 (English - world), but it had no effect.
4
0
1.3k
Sep ’26
Custom Keyboard extension
I’m developing a keyboard extension and noticed this weird issue. When I switch from normal keyboard to custom keyboard there is a faint overlay duplicate of the custom keyboard that comes from the top which makes the switching not seamless and I can’t seem to find the cause of this issue. I initially thought it had to do with the fact that it’s communicating with my app to get the latest data and check for edits but it’s not the case here. when I screen record it doesn’t appear as faint overlay, it appears as the keyboard becoming taller than usual and then sizing down to expected height. iOS26.6.2
1
0
396
Sep ’26
Accessibility API (AXUIElement) layout constraints on Apple Silicon
Hello everyone, I am the developer of a macOS window management app called NeoTiler. I am currently optimizing it entirely for Apple Silicon using Swift. I am using the Accessibility API (AXUIElementSetAttributeValue) to resize windows. While it works flawlessly on Safari and native apps, I've noticed a slight animation stutter when resizing Electron-based apps like VS Code or Discord. Has anyone experienced this specific stutter with AX APIs on M-series chips? Are there any workaround flags I should pass? Thanks!
0
1
795
Sep ’26
SwiftUI alert dismisses immediately when presented from a nested sheet
I found a SwiftUI presentation bug with multiple alerts and sheet presentations. I submitted a Feedback Assistant report too: Feedback ID: FB24621651 The issue is that a native SwiftUI alert dismisses immediately after appearing when it is presented from a view inside a nested sheet. Minimal hierarchy: TabView -> NavigationStack -> outer sheet -> NavigationStack -> detail view -> inner sheet -> alert The inner sheet contains a normal button: struct InnerSheetRoot: View { @State private var showAlert = false var body: some View { Button("Show Alert") { showAlert = true } .alert("Alert from inner sheet", isPresented: $showAlert) { Button("OK") {} } message: { Text("This alert should remain visible.") } } } Steps to reproduce Open the attached sample project. Select the Storage tab. Tap any storage row. In the outer sheet, tap Open Inner Sheet. In the inner sheet, tap Show Alert. Actual result The alert appears briefly and dismisses immediately. It may disappear before OK can be tapped. Expected result The alert should remain visible until the user taps OK. The issue disappears when I remove either the root TabView or the second NavigationStack. It also disappears when the inner sheet is removed. Environment: Xcode: Xcode 26.6 macOS: macOS 26.6.2 iOS: iOS 26.5 Device or simulator: iPhone Simulator Deployment target: iOS 26.0 Swift version: Swift 6 The example project and a screen recording are attached to the Feedback Assistant report, but they can also be found here. I would appreciate confirmation of whether this is a known SwiftUI presentation-host issue and whether there is a recommended way to present alerts from content inside nested sheets.
6
0
682
Sep ’26
The willThrow Tax: A hidden 36x slowdown and 2.1KB memory leak per throw in test frameworks
Context: While fuzzing my encrypted messenger Kalego, I noticed a single core pinned at 100% for over an hour while the other nine sat idle. No crash, no error. I sampled the thread with the macOS sample tool and found the culprit: a global runtime hook intercepting every single throw. Root Cause: The Swift runtime exposes a writable pointer _swift_willThrow. Apple's test frameworks install their own observers into this slot. On every throw, XCTest bridges the Swift error to an autoreleased NSError, captures the call stack, and accumulates it in memory until the end of the test method. The Numbers (Measured on M5, Swift 6.3.3, Release): Plain Executable: 20.5 ns / iteration Swift Testing: 295 ns / iteration (14x slower) XCTest: 749 ns / iteration (36x slower) XCTest under xcodebuild/CI: ~1100 ns (54x slower) The Real Defect (Memory Leak): It's not just slow. Under XCTest, each observed throw leaks ~2.1 KB of memory. 2,000,000 throws in a single test method cost +4,031 MB. At fuzzing scale, this turns a slow test into an instant Out-Of-Memory crash. The Fixes: Move the hot loop to a standalone executable (best for fuzzing). Use return nil instead of throw on hot paths. Wrap the loop body in autoreleasepool { } to stop the memory leak. (Advanced/Situational) Safely disable the observer using dlsym and defer (code provided in the full report). Full Report & Reproducible Code: I wrote a complete 12-page report with 21 experiments, the assembly disassembly, and all the reproduction code. You can check the numbers on your own machine here: https://github.com/MagicYassin/xctest-throw-cost Appreciate any technical feedback👨🏻‍💻☁️☁!
5
0
9.1k
Sep ’26
iOS27, CIRAWFilter RAW9 broken/missing in latest dev beta
In the WWDC talk: https://developer.apple.com/videos/play/wwdc2026/305/?time=350 "Enhance RAW image processing with Core Image" there is a section on the new RAW9 processing APIs and how to enable them. First off, the sample code compiles on iOS18 but causes a runtime exception because the .version9 symbol cannot be found, looks like the header definition is missing a version check for this value, so I'm not sure how to use this code if you need to support iOS18. Also on later dev betas (I tried the latest beta7) now trying to check if version9 is available the value is no longer present in the supported list: guard filter.supportedDecoderVersions.contains(.version9) else { ... There is another value .version9DNG that resolves to true but if I try to use that decoder the colors on the RAW image are wrong and the image becomes corrupted. How to use the RAW9 decoder in the latest dev betas, what should the final code before production because the WWDC sample now seems out of date and was always wrong wrt. iOS18.
3
0
1.6k
Sep ’26
USSD calls with * and # dont work iOS
I have an application that needs to make a USSD call, but on some devices the * and # don't work on the dialer, on others it does. if let phoneNumber = ussdNumberTextfield.text { let encoded = "telprompt:\(phoneNumber)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! if let url = URL(string: encoded) { if application.canOpenURL(url){ DispatchQueue.main.async { self.application.open(url, options: [:]) { success in } } } } }
7
0
2.5k
Sep ’26
Optimizing MapKit performance for high-frequency dynamic annotations / large datasets in Swift
Hi everyone, I am currently working on a SwiftUI / Swift client project that visualizes live, distributed infrastructure nodes across a dynamic map interface using MapKit. As the dataset scales and coordinates update dynamically, I want to ensure rendering performance stays smooth and memory overhead remains low. I would appreciate some guidance from the community on best practices for this scenario: Clustering vs. Custom Overlays: For frequently updating data points, is native annotation clustering (MKClusterAnnotation / clusteringIdentifier) the standard recommendation, or does heavy clustering introduce recalculation overhead during rapid state changes? Visible Region Filtering: What is the recommended pattern in modern MapKit (SwiftUI Map vs. MKMapViewRepresentable) for culling off-screen data points vs. letting MapKit handle view recycling? High-Frequency Updates: When coordinates or statuses update frequently (e.g., via polling or streaming data), what are the best practices to avoid unnecessary view rebuilds and maintain 60/120 FPS panning and zooming? Any architectural tips, performance benchmarks, or WWDC sessions you recommend reviewing for large-scale dynamic rendering would be greatly appreciated! Thanks in advance.
0
0
475
Aug ’26
SwiftUI List swipeActions stutter with variable row heights on ProMotion
I have isolated a reproducible animation issue involving SwiftUI List, system .swipeActions, variable row heights, and ProMotion. Environment: iPhone 17 Pro Max iOS 26.6 Xcode 26.5 Low Power Mode off “Limit Frame Rate” off iOS screen recording off When a List contains alternating single-line and two-line rows whose heights are determined naturally, slowly dragging a row left to reveal .swipeActions causes a visible pause. The row briefly stops following the finger, then jumps left. The trailing action buttons appear suddenly instead of being progressively revealed. Fast swipes are usually smooth. I created a minimal project with two modes: Variable: alternating single-line and two-line rows use their natural heights. Uniform: the same contents are constrained to a uniform height. Both modes use the same List, SF Symbol, tap gesture, and .swipeActions. The issue reproduces consistently in Variable mode, while Uniform mode remains smooth. A simplified version of the Row is: ForEach(0..<20, id: \.self) { index in HStack { Image(systemName: "folder") .frame(width: 28) VStack(alignment: .leading) { Text("Category \(index + 1)") if index.isMultiple(of: 2) { Text("Secondary information") .font(.caption) .foregroundStyle(.secondary) } } Spacer() } .swipeActions(edge: .trailing, allowsFullSwipe: false) { Button("Delete", systemImage: "trash") {} .tint(.red) Button("Hide", systemImage: "eye.slash") {} .tint(.orange) } } The unusual part is that the issue immediately disappears when any of the following is enabled: Low Power Mode Accessibility → Motion → Limit Frame Rate iOS screen recording It returns as soon as those conditions are disabled. I can also observe highly similar behavior in: Settings → General → iPhone Storage Rows with a “Last Used” subtitle appear taller than rows without it. Slowly swiping those rows can produce the same pause followed by the action UI suddenly appearing. The same frame-rate-related workarounds make that system list smooth as well. I have filed this through Feedback Assistant: FB24515209. Has anyone reproduced this on another ProMotion device, another iOS 26 version, or an iOS 27 beta? I am especially interested in whether there is a framework-supported workaround other than keeping all swipeable rows at a uniform height.
0
0
445
Aug ’26
Is it possible to intercept hardware (Bluetooth) keyboard events in an iOS Custom Keyboard Extension?
I'm developing an iOS custom keyboard extension and need to intercept external Bluetooth hardware keystrokes in the background. Can I capture these events within a UIInputViewController (e.g., using UIKeyCommand), or does iOS strictly route them directly to the host app? Are there any specific APIs or workarounds for this, or is it completely blocked by Apple's sandboxing policies?
1
0
695
Aug ’26
WKWebView+Purch+StoreKit=Deadend
Does anyone have any advice on working a way around this, or through this? My app is wrapped and WKWebView displays HTML/CSS/JAVA and StoreKit is iOS framework. I used choicely up wrap it because i don't own a mac. The only part i can't control is this. I'll likely have to wrap it myself, rent a cloud Mac and submit directly to ensure everything is attached to the binary. I can't control that from choicely. any other ideas!? I’ve been over a month trying to get this going. It’s live but with no way to transact the subscribers I’m already getting. HELP PLEASE!
0
0
564
Aug ’26
VNRecognizeTextRequest does not recognise single letters
I use VNRecognizeTextRequest to recognise a series of letters drawn by hand in the app. When I draw a few letters, it usually works fine. is recognised as "LV" But if I draw a single letter: or in most cases, I get zero observation, even using recognitionLevel3. But this was recognized as "V": It is apparently not a question of how well drawn letters, as even this was recognised as "LI": However, this one was not I have even tried to add custom words, to no avail: request.customWords = ["I", "V", "L"] General observation is that single letters are rarely or never recognised, dual letters may be recognised ; 3 letters are systematically recognised. But, I have now increased the brushWidth, and it works much better, even with single letter: What tuning of VNRecognizeTextRequest do I miss ?
5
0
457
Aug ’26
UISegmentedControl backgroundColor not applied on some iOS 26 devices
I’m seeing inconsistent UISegmentedControl background-color behavior on certain devices running iOS 26. The same code works as expected on other devices and iOS versions, but on affected devices the control does not display the assigned backgroundColor. The issue occurs using standard UIKit colors and does not depend on custom fonts, images, or appearance extensions. Here is a simplified example using only public UIKit APIs: private let segmentedControl = UISegmentedControl(items: ["Card", "Email"]) private func setupSegmentedControl() { segmentedControl.selectedSegmentIndex = 0 guard let cardIcon = UIImage( systemName: "creditcard.fill", withConfiguration: UIImage.SymbolConfiguration( pointSize: 14, weight: .semibold ) ), let emailIcon = UIImage( systemName: "envelope.fill", withConfiguration: UIImage.SymbolConfiguration( pointSize: 14, weight: .semibold ) ) else { return } segmentedControl.setImage( cardIcon, forSegmentAt: 0 ) segmentedControl.setImage( emailIcon, forSegmentAt: 1 ) segmentedControl.backgroundColor = .systemGray5 segmentedControl.selectedSegmentTintColor = .systemBlue segmentedControl.layer.cornerRadius = 8 segmentedControl.clipsToBounds = true let font = UIFont.systemFont( ofSize: 14, weight: .medium ) segmentedControl.setTitleTextAttributes( [ .foregroundColor: UIColor.label, .font: font ], for: .normal ) segmentedControl.setTitleTextAttributes( [ .foregroundColor: UIColor.white, .font: font ], for: .selected ) segmentedControl.addTarget( self, action: #selector(segmentChanged(_:)), for: .valueChanged ) view.addSubview(segmentedControl) } @objc private func segmentChanged( _ sender: UISegmentedControl ) { print("Selected segment: \(sender.selectedSegmentIndex)") } UISegmentedControl Apple Documentation
1
0
879
Aug ’26
API vs Accessibility
I’m developing a small macOS workflow utility for Final Cut Pro and I’d like to confirm whether there is a supported API for a particular project-management workflow before relying on macOS Accessibility automation. The utility is intended to take an existing Final Cut Pro project and create multiple native duplicates at different custom frame sizes — for example: 1920 × 1080 1080 × 1920 1080 × 1350 1080 × 1080 custom banner dimensions The desired operation is essentially the equivalent of Final Cut Pro’s Duplicate Project As… command: duplicate the selected project, assign a new name, set a custom video resolution, and optionally enable or disable Smart Conform. It is important that Final Cut Pro itself performs a native project duplication so that all existing project data is retained, including effects, grades, plug-ins, keyframes, compound clips, retiming and Magnetic Masks. I initially prototyped the workflow using FCPXML, which works very well for creating the differently sized projects. However, Apple’s documentation notes that Magnetic Masks are not included in XML exports, so an FCPXML round-trip is not suitable for this use case. I’ve reviewed the documentation for FCPXML, Workflow Extensions / ProExtensionHost, and programmatic communication with Final Cut Pro using Apple Events, but I haven’t found a documented API that allows an application to: Duplicate the currently selected Final Cut Pro project natively. Rename the duplicated project. Change its video format to an arbitrary custom width and height. Optionally control Smart Conform. I currently have a working proof of concept using the macOS Accessibility API to invoke and operate Final Cut Pro’s native Duplicate Project As… interface. Before developing that approach further, I’d like to confirm that I’m not overlooking a supported Final Cut Pro API or Workflow Extension capability that would accomplish the same thing more directly and robustly. Is there a supported public API for this workflow, either through the Workflow Extension SDK, ProExtensionHost, Apple Events, scripting support, or another Professional Video Applications framework? If not, is using macOS Accessibility to automate Final Cut Pro’s native project-duplication interface an appropriate approach for a third-party macOS workflow utility? Many thanks, James
0
0
406
Aug ’26
Liquid glass problems in UIToolbar
I add a series of buttons in the UIToolbar of accessoryView. Before liquidGlass (Xcode 26.6, iOS 26), I get this: Buttons are properly stacked, allowing up to 8 buttons, which is what I need. But with liquidGlass, buttons are now enclosed in a useless bubble, and thus take much more space. No way to accommodate 8 buttons anymore, they are displayed in the "…" followup section, which is very inconvenient. In iOS 26, I can still set UIDesignRequiresCompatibility to true and get the expected presentation. But that does not work in Xcode 27 / iOS 27. Code is essentially the following: let bar = UIToolbar(frame:CGRect(x: 0, y: 0, width: 200, height: 44)) let letterBack = UIImage(named: "letterBackground")! let targetSize = CGSize(width: 36, height: 36) let scaledImage = letterBack.scalePreservingAspectRatio( targetSize: targetSize ) let letterI = UIBarButtonItem(title: "I", style: .plain, target: self, action: #selector(letterTapped(_:))) letterI.setBackgroundImage(scaledImage, for: .normal, barMetrics: .default) // Same for other letters bar.items = [letterI, letterV, letterX, letterL, letterC, flexibleSpace, peseudoReturn] bar.sizeToFit() aTextField.inputAccessoryView = bar I have tried to use barMetrics: .compact to no avail So, a few questions: Is it possible, with liquidGlass, to have the buttons displayed without their ellipse bubble, so that they stack against each other ? Is there other appearence setting to set ? Or should I give up toolbar and create a collectionView that I will place atop keyboard ? In anycase, liquidGlass is really problematic in term of screen estate use.
2
0
1.1k
Aug ’26
emoji don't show in UITextField with Xcode 27 ?
Using Xcode 27.0ß4. I set a textField text with an emoji: statusReponseLabel.text = "👍" In iOS 27, I get the expected result (on the left). In iOS 26.3 (simulator), I just get a question mark. I have tested with a print, the text is properly set. I replaced with: statusReponseLabel.text = "A👍B" In iOS 26.3, I get A followed by the question mark, B is skipped as well. Is it an iOS issue or just a simulator issue in beta version ?
0
0
441
Aug ’26
Multiple MFMessageComposeViewController
Does iOS support launching of 2 MFMessageComposeViewControllers back to back i.e without dismissing the previous one? We are integrating an SDK from a vendor who, inside the SDK is presenting the MFMessageComposeViewController 2 times back to back, and one of the MFMessageComposeViewController is getting dismissed but the other one doesn't, their standalone app does the same but it works there, not inside the SDK, Just wanted to know why the second MFMessageComposeViewController doesn't dismiss, or is it the correct approach to do so.
0
0
680
Aug ’26
UITabBarAppearance with iOS27 Beta
iOS Version: iOS 27 Beta Xcode: Xcode27 Beta 2 I have a custom UITabBar subclass. The tab bar items are visible and selectable, and the selected state works, but the title color in the normal state is always rendered as white, even though I set a different normal title color. Simplified code let normalColor = UIColor.gray let selectedColor = UIColor.orange let bgColor = UIColor.black let font = UIFont.systemFont(ofSize: 10, weight: .semibold) let appearance = UITabBarAppearance() appearance.configureWithOpaqueBackground() appearance.backgroundEffect = nil appearance.backgroundColor = bgColor appearance.shadowColor = .clear let itemAppearance = appearance.stackedLayoutAppearance itemAppearance.normal.titleTextAttributes = [ .font: font, .foregroundColor: normalColor ] itemAppearance.selected.titleTextAttributes = [ .font: font, .foregroundColor: selectedColor ] itemAppearance.normal.iconColor = normalColor itemAppearance.selected.iconColor = selectedColor appearance.stackedLayoutAppearance = itemAppearance appearance.inlineLayoutAppearance = itemAppearance appearance.compactInlineLayoutAppearance = itemAppearance tabBar.standardAppearance = appearance if #available(iOS 15.0, *) { tabBar.scrollEdgeAppearance = appearance } tabBar.backgroundColor = bgColor tabBar.isTranslucent = false The problem: The selected title/icon color works. The normal title color is ignored and stays white. This happens after moving to the newer tab bar appearance behavior / Liquid Glass environment. Question: Is there any additional configuration required for UITabBarAppearance so that the normal UITabBarItem title color is respected? Could unselectedItemTintColor, tintColor, scrollEdgeAppearance, or Liquid Glass behavior override normal.titleTextAttributes?
Replies
4
Boosts
0
Views
924
Activity
4w
Error in Xcode console
Lately I am getting this error. GenerativeModelsAvailability.Parameters: Initialized with invalid language code: en-GB. Expected to receive two-letter ISO 639 code. e.g. 'zh' or 'en'. Falling back to: en Does anyone know what this is and how it can be resolved. The error does not crash the app
Replies
5
Boosts
2
Views
2.1k
Activity
Sep ’26
Bundle preferred languages mechanism
Hi there, I’m curious to understand how the system determines which language to use for an app. The system is currently set to en-IN (English - India). My app supports the following languages: en (the default development language) en-GB (United Kingdom) en-IE (Ireland) en-US (United States) When I run the app, the Bundle.main.preferredLanguages returns [„en-GB“, „en“], which causes the app to be set to en-GB. However, when the app doesn’t support the preferred system language, I would expect it to default to the en language. Surprisingly, this is not the case. This behavior is precisely described in Technical Note TN2418. Unfortunately, there’s no explanation provided. Is this behavior related to the CLDR Linguistic Distance? I also attempted to replace the default development language en with en-001 (English - world), but it had no effect.
Replies
4
Boosts
0
Views
1.3k
Activity
Sep ’26
Custom Keyboard extension
I’m developing a keyboard extension and noticed this weird issue. When I switch from normal keyboard to custom keyboard there is a faint overlay duplicate of the custom keyboard that comes from the top which makes the switching not seamless and I can’t seem to find the cause of this issue. I initially thought it had to do with the fact that it’s communicating with my app to get the latest data and check for edits but it’s not the case here. when I screen record it doesn’t appear as faint overlay, it appears as the keyboard becoming taller than usual and then sizing down to expected height. iOS26.6.2
Replies
1
Boosts
0
Views
396
Activity
Sep ’26
Accessibility API (AXUIElement) layout constraints on Apple Silicon
Hello everyone, I am the developer of a macOS window management app called NeoTiler. I am currently optimizing it entirely for Apple Silicon using Swift. I am using the Accessibility API (AXUIElementSetAttributeValue) to resize windows. While it works flawlessly on Safari and native apps, I've noticed a slight animation stutter when resizing Electron-based apps like VS Code or Discord. Has anyone experienced this specific stutter with AX APIs on M-series chips? Are there any workaround flags I should pass? Thanks!
Replies
0
Boosts
1
Views
795
Activity
Sep ’26
SwiftUI alert dismisses immediately when presented from a nested sheet
I found a SwiftUI presentation bug with multiple alerts and sheet presentations. I submitted a Feedback Assistant report too: Feedback ID: FB24621651 The issue is that a native SwiftUI alert dismisses immediately after appearing when it is presented from a view inside a nested sheet. Minimal hierarchy: TabView -> NavigationStack -> outer sheet -> NavigationStack -> detail view -> inner sheet -> alert The inner sheet contains a normal button: struct InnerSheetRoot: View { @State private var showAlert = false var body: some View { Button("Show Alert") { showAlert = true } .alert("Alert from inner sheet", isPresented: $showAlert) { Button("OK") {} } message: { Text("This alert should remain visible.") } } } Steps to reproduce Open the attached sample project. Select the Storage tab. Tap any storage row. In the outer sheet, tap Open Inner Sheet. In the inner sheet, tap Show Alert. Actual result The alert appears briefly and dismisses immediately. It may disappear before OK can be tapped. Expected result The alert should remain visible until the user taps OK. The issue disappears when I remove either the root TabView or the second NavigationStack. It also disappears when the inner sheet is removed. Environment: Xcode: Xcode 26.6 macOS: macOS 26.6.2 iOS: iOS 26.5 Device or simulator: iPhone Simulator Deployment target: iOS 26.0 Swift version: Swift 6 The example project and a screen recording are attached to the Feedback Assistant report, but they can also be found here. I would appreciate confirmation of whether this is a known SwiftUI presentation-host issue and whether there is a recommended way to present alerts from content inside nested sheets.
Replies
6
Boosts
0
Views
682
Activity
Sep ’26
The willThrow Tax: A hidden 36x slowdown and 2.1KB memory leak per throw in test frameworks
Context: While fuzzing my encrypted messenger Kalego, I noticed a single core pinned at 100% for over an hour while the other nine sat idle. No crash, no error. I sampled the thread with the macOS sample tool and found the culprit: a global runtime hook intercepting every single throw. Root Cause: The Swift runtime exposes a writable pointer _swift_willThrow. Apple's test frameworks install their own observers into this slot. On every throw, XCTest bridges the Swift error to an autoreleased NSError, captures the call stack, and accumulates it in memory until the end of the test method. The Numbers (Measured on M5, Swift 6.3.3, Release): Plain Executable: 20.5 ns / iteration Swift Testing: 295 ns / iteration (14x slower) XCTest: 749 ns / iteration (36x slower) XCTest under xcodebuild/CI: ~1100 ns (54x slower) The Real Defect (Memory Leak): It's not just slow. Under XCTest, each observed throw leaks ~2.1 KB of memory. 2,000,000 throws in a single test method cost +4,031 MB. At fuzzing scale, this turns a slow test into an instant Out-Of-Memory crash. The Fixes: Move the hot loop to a standalone executable (best for fuzzing). Use return nil instead of throw on hot paths. Wrap the loop body in autoreleasepool { } to stop the memory leak. (Advanced/Situational) Safely disable the observer using dlsym and defer (code provided in the full report). Full Report & Reproducible Code: I wrote a complete 12-page report with 21 experiments, the assembly disassembly, and all the reproduction code. You can check the numbers on your own machine here: https://github.com/MagicYassin/xctest-throw-cost Appreciate any technical feedback👨🏻‍💻☁️☁!
Replies
5
Boosts
0
Views
9.1k
Activity
Sep ’26
iOS27, CIRAWFilter RAW9 broken/missing in latest dev beta
In the WWDC talk: https://developer.apple.com/videos/play/wwdc2026/305/?time=350 "Enhance RAW image processing with Core Image" there is a section on the new RAW9 processing APIs and how to enable them. First off, the sample code compiles on iOS18 but causes a runtime exception because the .version9 symbol cannot be found, looks like the header definition is missing a version check for this value, so I'm not sure how to use this code if you need to support iOS18. Also on later dev betas (I tried the latest beta7) now trying to check if version9 is available the value is no longer present in the supported list: guard filter.supportedDecoderVersions.contains(.version9) else { ... There is another value .version9DNG that resolves to true but if I try to use that decoder the colors on the RAW image are wrong and the image becomes corrupted. How to use the RAW9 decoder in the latest dev betas, what should the final code before production because the WWDC sample now seems out of date and was always wrong wrt. iOS18.
Replies
3
Boosts
0
Views
1.6k
Activity
Sep ’26
USSD calls with * and # dont work iOS
I have an application that needs to make a USSD call, but on some devices the * and # don't work on the dialer, on others it does. if let phoneNumber = ussdNumberTextfield.text { let encoded = "telprompt:\(phoneNumber)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! if let url = URL(string: encoded) { if application.canOpenURL(url){ DispatchQueue.main.async { self.application.open(url, options: [:]) { success in } } } } }
Replies
7
Boosts
0
Views
2.5k
Activity
Sep ’26
Optimizing MapKit performance for high-frequency dynamic annotations / large datasets in Swift
Hi everyone, I am currently working on a SwiftUI / Swift client project that visualizes live, distributed infrastructure nodes across a dynamic map interface using MapKit. As the dataset scales and coordinates update dynamically, I want to ensure rendering performance stays smooth and memory overhead remains low. I would appreciate some guidance from the community on best practices for this scenario: Clustering vs. Custom Overlays: For frequently updating data points, is native annotation clustering (MKClusterAnnotation / clusteringIdentifier) the standard recommendation, or does heavy clustering introduce recalculation overhead during rapid state changes? Visible Region Filtering: What is the recommended pattern in modern MapKit (SwiftUI Map vs. MKMapViewRepresentable) for culling off-screen data points vs. letting MapKit handle view recycling? High-Frequency Updates: When coordinates or statuses update frequently (e.g., via polling or streaming data), what are the best practices to avoid unnecessary view rebuilds and maintain 60/120 FPS panning and zooming? Any architectural tips, performance benchmarks, or WWDC sessions you recommend reviewing for large-scale dynamic rendering would be greatly appreciated! Thanks in advance.
Replies
0
Boosts
0
Views
475
Activity
Aug ’26
SwiftUI List swipeActions stutter with variable row heights on ProMotion
I have isolated a reproducible animation issue involving SwiftUI List, system .swipeActions, variable row heights, and ProMotion. Environment: iPhone 17 Pro Max iOS 26.6 Xcode 26.5 Low Power Mode off “Limit Frame Rate” off iOS screen recording off When a List contains alternating single-line and two-line rows whose heights are determined naturally, slowly dragging a row left to reveal .swipeActions causes a visible pause. The row briefly stops following the finger, then jumps left. The trailing action buttons appear suddenly instead of being progressively revealed. Fast swipes are usually smooth. I created a minimal project with two modes: Variable: alternating single-line and two-line rows use their natural heights. Uniform: the same contents are constrained to a uniform height. Both modes use the same List, SF Symbol, tap gesture, and .swipeActions. The issue reproduces consistently in Variable mode, while Uniform mode remains smooth. A simplified version of the Row is: ForEach(0..<20, id: \.self) { index in HStack { Image(systemName: "folder") .frame(width: 28) VStack(alignment: .leading) { Text("Category \(index + 1)") if index.isMultiple(of: 2) { Text("Secondary information") .font(.caption) .foregroundStyle(.secondary) } } Spacer() } .swipeActions(edge: .trailing, allowsFullSwipe: false) { Button("Delete", systemImage: "trash") {} .tint(.red) Button("Hide", systemImage: "eye.slash") {} .tint(.orange) } } The unusual part is that the issue immediately disappears when any of the following is enabled: Low Power Mode Accessibility → Motion → Limit Frame Rate iOS screen recording It returns as soon as those conditions are disabled. I can also observe highly similar behavior in: Settings → General → iPhone Storage Rows with a “Last Used” subtitle appear taller than rows without it. Slowly swiping those rows can produce the same pause followed by the action UI suddenly appearing. The same frame-rate-related workarounds make that system list smooth as well. I have filed this through Feedback Assistant: FB24515209. Has anyone reproduced this on another ProMotion device, another iOS 26 version, or an iOS 27 beta? I am especially interested in whether there is a framework-supported workaround other than keeping all swipeable rows at a uniform height.
Replies
0
Boosts
0
Views
445
Activity
Aug ’26
Inserting a SF Symbol in a textField or a Label, as text
In UIKit, Swift, I would need to insert a SF Symbol into a textField or a label. The symbol shows correctly in Xcode (in a string in code or in IB). But at runtime, the symbol is not found and replaced in the TextField by the unfound symbol: Is there a way to achieve this and display the symbol as a pure string, like we do with emoji ?
Replies
7
Boosts
0
Views
1k
Activity
Aug ’26
Is it possible to intercept hardware (Bluetooth) keyboard events in an iOS Custom Keyboard Extension?
I'm developing an iOS custom keyboard extension and need to intercept external Bluetooth hardware keystrokes in the background. Can I capture these events within a UIInputViewController (e.g., using UIKeyCommand), or does iOS strictly route them directly to the host app? Are there any specific APIs or workarounds for this, or is it completely blocked by Apple's sandboxing policies?
Replies
1
Boosts
0
Views
695
Activity
Aug ’26
WKWebView+Purch+StoreKit=Deadend
Does anyone have any advice on working a way around this, or through this? My app is wrapped and WKWebView displays HTML/CSS/JAVA and StoreKit is iOS framework. I used choicely up wrap it because i don't own a mac. The only part i can't control is this. I'll likely have to wrap it myself, rent a cloud Mac and submit directly to ensure everything is attached to the binary. I can't control that from choicely. any other ideas!? I’ve been over a month trying to get this going. It’s live but with no way to transact the subscribers I’m already getting. HELP PLEASE!
Replies
0
Boosts
0
Views
564
Activity
Aug ’26
VNRecognizeTextRequest does not recognise single letters
I use VNRecognizeTextRequest to recognise a series of letters drawn by hand in the app. When I draw a few letters, it usually works fine. is recognised as "LV" But if I draw a single letter: or in most cases, I get zero observation, even using recognitionLevel3. But this was recognized as "V": It is apparently not a question of how well drawn letters, as even this was recognised as "LI": However, this one was not I have even tried to add custom words, to no avail: request.customWords = ["I", "V", "L"] General observation is that single letters are rarely or never recognised, dual letters may be recognised ; 3 letters are systematically recognised. But, I have now increased the brushWidth, and it works much better, even with single letter: What tuning of VNRecognizeTextRequest do I miss ?
Replies
5
Boosts
0
Views
457
Activity
Aug ’26
UISegmentedControl backgroundColor not applied on some iOS 26 devices
I’m seeing inconsistent UISegmentedControl background-color behavior on certain devices running iOS 26. The same code works as expected on other devices and iOS versions, but on affected devices the control does not display the assigned backgroundColor. The issue occurs using standard UIKit colors and does not depend on custom fonts, images, or appearance extensions. Here is a simplified example using only public UIKit APIs: private let segmentedControl = UISegmentedControl(items: ["Card", "Email"]) private func setupSegmentedControl() { segmentedControl.selectedSegmentIndex = 0 guard let cardIcon = UIImage( systemName: "creditcard.fill", withConfiguration: UIImage.SymbolConfiguration( pointSize: 14, weight: .semibold ) ), let emailIcon = UIImage( systemName: "envelope.fill", withConfiguration: UIImage.SymbolConfiguration( pointSize: 14, weight: .semibold ) ) else { return } segmentedControl.setImage( cardIcon, forSegmentAt: 0 ) segmentedControl.setImage( emailIcon, forSegmentAt: 1 ) segmentedControl.backgroundColor = .systemGray5 segmentedControl.selectedSegmentTintColor = .systemBlue segmentedControl.layer.cornerRadius = 8 segmentedControl.clipsToBounds = true let font = UIFont.systemFont( ofSize: 14, weight: .medium ) segmentedControl.setTitleTextAttributes( [ .foregroundColor: UIColor.label, .font: font ], for: .normal ) segmentedControl.setTitleTextAttributes( [ .foregroundColor: UIColor.white, .font: font ], for: .selected ) segmentedControl.addTarget( self, action: #selector(segmentChanged(_:)), for: .valueChanged ) view.addSubview(segmentedControl) } @objc private func segmentChanged( _ sender: UISegmentedControl ) { print("Selected segment: \(sender.selectedSegmentIndex)") } UISegmentedControl Apple Documentation
Replies
1
Boosts
0
Views
879
Activity
Aug ’26
API vs Accessibility
I’m developing a small macOS workflow utility for Final Cut Pro and I’d like to confirm whether there is a supported API for a particular project-management workflow before relying on macOS Accessibility automation. The utility is intended to take an existing Final Cut Pro project and create multiple native duplicates at different custom frame sizes — for example: 1920 × 1080 1080 × 1920 1080 × 1350 1080 × 1080 custom banner dimensions The desired operation is essentially the equivalent of Final Cut Pro’s Duplicate Project As… command: duplicate the selected project, assign a new name, set a custom video resolution, and optionally enable or disable Smart Conform. It is important that Final Cut Pro itself performs a native project duplication so that all existing project data is retained, including effects, grades, plug-ins, keyframes, compound clips, retiming and Magnetic Masks. I initially prototyped the workflow using FCPXML, which works very well for creating the differently sized projects. However, Apple’s documentation notes that Magnetic Masks are not included in XML exports, so an FCPXML round-trip is not suitable for this use case. I’ve reviewed the documentation for FCPXML, Workflow Extensions / ProExtensionHost, and programmatic communication with Final Cut Pro using Apple Events, but I haven’t found a documented API that allows an application to: Duplicate the currently selected Final Cut Pro project natively. Rename the duplicated project. Change its video format to an arbitrary custom width and height. Optionally control Smart Conform. I currently have a working proof of concept using the macOS Accessibility API to invoke and operate Final Cut Pro’s native Duplicate Project As… interface. Before developing that approach further, I’d like to confirm that I’m not overlooking a supported Final Cut Pro API or Workflow Extension capability that would accomplish the same thing more directly and robustly. Is there a supported public API for this workflow, either through the Workflow Extension SDK, ProExtensionHost, Apple Events, scripting support, or another Professional Video Applications framework? If not, is using macOS Accessibility to automate Final Cut Pro’s native project-duplication interface an appropriate approach for a third-party macOS workflow utility? Many thanks, James
Replies
0
Boosts
0
Views
406
Activity
Aug ’26
Liquid glass problems in UIToolbar
I add a series of buttons in the UIToolbar of accessoryView. Before liquidGlass (Xcode 26.6, iOS 26), I get this: Buttons are properly stacked, allowing up to 8 buttons, which is what I need. But with liquidGlass, buttons are now enclosed in a useless bubble, and thus take much more space. No way to accommodate 8 buttons anymore, they are displayed in the "…" followup section, which is very inconvenient. In iOS 26, I can still set UIDesignRequiresCompatibility to true and get the expected presentation. But that does not work in Xcode 27 / iOS 27. Code is essentially the following: let bar = UIToolbar(frame:CGRect(x: 0, y: 0, width: 200, height: 44)) let letterBack = UIImage(named: "letterBackground")! let targetSize = CGSize(width: 36, height: 36) let scaledImage = letterBack.scalePreservingAspectRatio( targetSize: targetSize ) let letterI = UIBarButtonItem(title: "I", style: .plain, target: self, action: #selector(letterTapped(_:))) letterI.setBackgroundImage(scaledImage, for: .normal, barMetrics: .default) // Same for other letters bar.items = [letterI, letterV, letterX, letterL, letterC, flexibleSpace, peseudoReturn] bar.sizeToFit() aTextField.inputAccessoryView = bar I have tried to use barMetrics: .compact to no avail So, a few questions: Is it possible, with liquidGlass, to have the buttons displayed without their ellipse bubble, so that they stack against each other ? Is there other appearence setting to set ? Or should I give up toolbar and create a collectionView that I will place atop keyboard ? In anycase, liquidGlass is really problematic in term of screen estate use.
Replies
2
Boosts
0
Views
1.1k
Activity
Aug ’26
emoji don't show in UITextField with Xcode 27 ?
Using Xcode 27.0ß4. I set a textField text with an emoji: statusReponseLabel.text = "👍" In iOS 27, I get the expected result (on the left). In iOS 26.3 (simulator), I just get a question mark. I have tested with a print, the text is properly set. I replaced with: statusReponseLabel.text = "A👍B" In iOS 26.3, I get A followed by the question mark, B is skipped as well. Is it an iOS issue or just a simulator issue in beta version ?
Replies
0
Boosts
0
Views
441
Activity
Aug ’26
Multiple MFMessageComposeViewController
Does iOS support launching of 2 MFMessageComposeViewControllers back to back i.e without dismissing the previous one? We are integrating an SDK from a vendor who, inside the SDK is presenting the MFMessageComposeViewController 2 times back to back, and one of the MFMessageComposeViewController is getting dismissed but the other one doesn't, their standalone app does the same but it works there, not inside the SDK, Just wanted to know why the second MFMessageComposeViewController doesn't dismiss, or is it the correct approach to do so.
Replies
0
Boosts
0
Views
680
Activity
Aug ’26