Search results for

“swiftui”

17,488 results found

Post

Replies

Boosts

Views

Activity

Reply to Best practices
Welcome to the forum Lexie. Asking for best practices generally is a bit too vague. Do you speak of app architecture, data management, UI design, on framework to use (UIKit or SwiftUI), language (Swift, ObjC), Swift code writing… I understand you are a seasoned developer, so this material may be useful, but may be not fully answering your question: https://developer.apple.com/pathways/?cid=ht-pathways Otherwise, a best practice is to ask on the forum when you wonder what you should do. Look at this to best formulate your questions: https://developer.apple.com/forums/thread/706527
3w
Widget Extension still uses system language even though CFBundleAllowMixedLocalizations = NO is set
I have an app with a Widget Extension. Both the main app and the widget extension link against the same Swift Package, which contains a localization bundle (String Catalog) used by SwiftUI views inside the package. To make the package's views follow the app's configured language (rather than the system language), I set CFBundleAllowMixedLocalizations to NO in the Info.plist of each target (main app and widget extension). Behavior in the main app: This works as expected. If the app only supports Korean, the package's views display Korean text even when the system language is set to English. Behavior in the widget: The same views (from the same package) display English instead of Korean, even though the widget extension has the identical CFBundleAllowMixedLocalizations = NO setting and the widget's view code lives entirely in the package — not in the widget extension target itself. Question: As far as I understand, widgets are supposed to follow the host app's language setting. Given that both targets
1
0
662
3w
iPad app terminated by watchdog (0x8BADF00D) during navigation transition — only with AssistiveTouch enabled (iPadOS 26)
Our app is being killed by the watchdog on iPadOS 26 (iPad Pro 11, 3rd gen) when navigating between tabs after using search. The crash only occurs when AssistiveTouch is enabled — disabling it prevents the issue entirely. The crash stack shows the main thread blocked in CoreUI vector glyph rasterization (CUINamedVectorGlyph _layerNamesForRenderingMode:inRendition:) triggered during a UINavigationController transition while the keyboard is being dismissed: UINavigationController _startCustomTransition → UIKeyboardSceneDelegate _restoreInputViewsWithId → UITextField resignFirstResponder → SwiftUI ViewGraphRootValueUpdater.render → UIButton layoutSubviews → UIImageView _setImage → CUINamedVectorGlyph _layerNamesForRenderingMode:inRendition: The termination reason: FRONTBOARD domain:10 code:0x8BADF00D Failed to terminate gracefully after 5.0s WatchdogEvent: process-exit WatchdogVisibility: Foreground Key observations: Only reproduces with AssistiveTouch enabled iPad Pro 11 (3rd gen), iPadOS 26 Our code i
3
0
4.0k
3w
Public API to overlay or hide the system keyboard while preserving its exact state?
I am building an iOS text composer with an attachment panel. When its UITextField is first responder and the system keyboard is visible, tapping the attachment button should present a panel that can extend into the region occupied by the keyboard. When the panel closes, the user should return to the same keyboard state without a visible dismissal and re-presentation. The required continuity is: The same UITextField remains first responder. The active input mode remains alphabet, 123, or Emoji. Emoji preserves its selected category, search state, and scroll position. The composer remains positioned above the keyboard throughout the transition. I have investigated the public UIKit approaches: A normal app-window overlay cannot render above the remotely hosted system keyboard. inputAccessoryView remains in the accessory region and cannot cover the keycaps. Resigning first responder visibly dismisses the keyboard and loses continuity. Assigning a custom inputView to the same UITextField and calling reloadInputVie
1
0
260
3w
Reply to Enhancing age-appropriate experiences
Hello @Bianca_, Thank you for your post. That's a good suggestion, however these forums are for questions about developing software and accessories for Apple platforms. If you would like to develop your own app that teaches literacy, these forums are a great place to ask questions – and SwiftUI contains accessible and easy to use frameworks for accomplishing this goal. Your question seems related to a consumer feature and is better suited as an Enhancement Request filed through Feedback Assistant. I would recommend to file an enhancement request, this way it goes to the relevant teams. I hope this information is helpful.  Travis
3w
Reply to CKShare save fails with BAD_REQUEST on _pcs_data in Production private database
Resolved. Two separate causes, neither visible from the client-side CKError. The Production schema was missing the system record type cloudkit.share. Enabling verbose error output in our own build surfaced the real server text: CKError 12 - Cannot create new type cloudkit.share in production schema CloudKit Console confirmed neither Development nor Production had cloudkit.share (only our own MedStatus and Users). This type cannot be created by hand in the console. It is auto-created the first time a share is actually saved in the DEVELOPMENT environment, and then must be pushed with Deploy Schema Changes. Our app had only ever run against Production (TestFlight / App Store builds), so that type was never created. The BAD_REQUEST on _pcs_data was the downstream symptom, not the cause. Fix: install a Debug build on a device (Development environment), perform one share, confirm cloudkit.share appears under Record Types, then Deploy Schema Changes to Production. Note for testing Production on-device: a Release co
Topic: App & System Services SubTopic: iCloud Tags:
3w
SwiftUI.AsyncRenderer crashes in ScrollView initializer.
I have a few crashes on my project that happen in the wild, and the stack trace looks like this, from a thread that is not the main thread: Crashed: com.apple.SwiftUI.AsyncRenderer 0 libdispatch.dylib 0x36f1c _dispatch_assert_queue_fail + 120 1 libdispatch.dylib 0x37988 dispatch_assert_queue$V2.cold.2 + 114 2 libdispatch.dylib 0x5094 dispatch_assert_queue + 108 3 libdispatch.dylib 0x5094 dispatch_assert_queue$V2 + 108 4 libswift_Concurrency.dylib 0xedfc _swift_task_checkIsolatedSwift + 48 5 libswift_Concurrency.dylib 0x6fc4 swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag) + 356 6 Xogot 0x2585a78 closure #1 in Toolbar3D.dockedBody.getter + 195 (Toolbar3D.swift:195) 7 SwiftUI 0xeae60 ScrollView.init(_:showsIndicators:content:) + 136 8 Xogot 0x2585798 Toolbar3D.body.getter + 207 (Toolbar3D.swift:207) 9 SwiftUICore 0x31614 closure #1 in ViewBodyAccessor.updateBody(of:changed:) + 1068 10 SwiftUICore 0x311b0 ViewBodyAccessor.updateBody(of:chang
Topic: UI Frameworks SubTopic: SwiftUI
2
0
166
3w
Reply to macOS 27 Catalyst: WKWebView text entry impossible, endless keyboard input-view focus loop
Solved. Two things together cause it: .focusable() + .focused($isFocused) on the SwiftUI container holding the WKWebView. The app echoing the page's focus reports back into that state — page posts on focus/blur, app sets isFocused = true/false. Either alone types fine. A single focus drive at load does not reproduce; it has to be the echo. A plain is enough — not Monaco-specific. Fix: if #available(iOS 27, *) { content } else { content.focusable().focused($isFocused) } Correcting myself: a workaround does exist, and my earlier claim that -becomeFirstResponder re-arms an endless loop was measured with .focusable() still applied, so treat it as unverified. FB24092251 has a standalone repro project attached.
Topic: UI Frameworks SubTopic: UIKit Tags:
3w
Pinch gesture not recognized on MTKView when attaching it to a RealityView using a ViewAttachmentComponent in a immersive space
Hello! We are seeing a problem with a SwiftUI view that wraps an MTKView and that MTKView uses gesture recognizers from UIKit. One of those gestures we are using is UIPinchGestureRecognizer. And that gesture isn’t recognized at all when the SwiftUI view is attached to a RealityView using the ViewAttachmentComponent AND the RealityView is being shown in an ImmersiveSpace. If the SwiftUI view is attached to the RealityView using the init that has an attachment closure then pinching works fine there. So this definitely seems like a bug. Here is some code to help you reproduce the problem. Run this on a Vision Pro device. A simple red square will be rendered and if a single tap or pinch gesture is recognized on the red square, it will print to the console. App Code: import SwiftUI @main struct VisionPinchProblemsApp: App { var body: some Scene { WindowGroup { MenuView() } ImmersiveSpace(id: RedSquare) { RedSquareView() } } } View code: import MetalKit import RealityKit import SwiftUI
1
0
631
3w
How to limit SwiftUI PasteButton for custom URLs?
For GNU Taler, we defined a custom URL scheme: taler://. We want to have a SwiftUI PasteButton in our app which is only active/enabled when the user copied a talerURI, but not for other URIs (such as https:// or mailto://). Currently we use PasteButton(supportedContentTypes: [.url]) { providers in which works, but is also enabled when the copied text is some other URI, not only for taler://. Can we define a UTType .taler for PasteButton to check whether the pasteBoard has indeed a talerURI? How?
Topic: UI Frameworks SubTopic: SwiftUI
1
0
392
3w
Intermittent UIHostingController layout regression after app launch on iPadOS 27 beta 4
On iPadOS 27.0 beta 4, SwiftUI views hosted inside UIKit-managed containers/overlays can be laid out incorrectly. The same app and same code work correctly on iPadOS 26.x release versions. One visible example is the app’s About dialog. The dialog is implemented as a UIKit UIViewController presented with UIModalPresentationFormSheet. Inside that controller, a UIHostingController is added as a child view controller, and the hosting controller’s view is constrained to all four edges of the parent view. The SwiftUI root view is a VStack containing the app icon, app name, version, text, links, and buttons. Expected behavior: The SwiftUI content should be vertically centered inside the form sheet. The app icon should appear above the app title, followed by the version, text, links, and buttons. This is the behavior on iPadOS 26.x. Actual behavior on iPadOS 27.0 beta 4: When the About dialog is opened immediately after launching the app, this issue occurs intermittently. The form sheet its
1
0
422
3w
Reply to Best practices
Welcome to the forum Lexie. Asking for best practices generally is a bit too vague. Do you speak of app architecture, data management, UI design, on framework to use (UIKit or SwiftUI), language (Swift, ObjC), Swift code writing… I understand you are a seasoned developer, so this material may be useful, but may be not fully answering your question: https://developer.apple.com/pathways/?cid=ht-pathways Otherwise, a best practice is to ask on the forum when you wonder what you should do. Look at this to best formulate your questions: https://developer.apple.com/forums/thread/706527
Replies
Boosts
Views
Activity
3w
Reply to Indentation in SwiftUI?
A personal opinion. That's an example why I find SwiftUI problematic, compared to UIKit or WatchKit when you want precise control. It's like trying to make lace with boxing gloves 😢
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
3w
Widget Extension still uses system language even though CFBundleAllowMixedLocalizations = NO is set
I have an app with a Widget Extension. Both the main app and the widget extension link against the same Swift Package, which contains a localization bundle (String Catalog) used by SwiftUI views inside the package. To make the package's views follow the app's configured language (rather than the system language), I set CFBundleAllowMixedLocalizations to NO in the Info.plist of each target (main app and widget extension). Behavior in the main app: This works as expected. If the app only supports Korean, the package's views display Korean text even when the system language is set to English. Behavior in the widget: The same views (from the same package) display English instead of Korean, even though the widget extension has the identical CFBundleAllowMixedLocalizations = NO setting and the widget's view code lives entirely in the package — not in the widget extension target itself. Question: As far as I understand, widgets are supposed to follow the host app's language setting. Given that both targets
Replies
1
Boosts
0
Views
662
Activity
3w
Reply to How to make a layout like Android's StaggeredGridLayoutManager in SwiftUI
No. You must drop down to UICollection and NSCollectionView. We just got recycling lazy grids in OS27. Custom lazy layouts are not available. Yes, SwiftUI is 7 years old.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
3w
iPad app terminated by watchdog (0x8BADF00D) during navigation transition — only with AssistiveTouch enabled (iPadOS 26)
Our app is being killed by the watchdog on iPadOS 26 (iPad Pro 11, 3rd gen) when navigating between tabs after using search. The crash only occurs when AssistiveTouch is enabled — disabling it prevents the issue entirely. The crash stack shows the main thread blocked in CoreUI vector glyph rasterization (CUINamedVectorGlyph _layerNamesForRenderingMode:inRendition:) triggered during a UINavigationController transition while the keyboard is being dismissed: UINavigationController _startCustomTransition → UIKeyboardSceneDelegate _restoreInputViewsWithId → UITextField resignFirstResponder → SwiftUI ViewGraphRootValueUpdater.render → UIButton layoutSubviews → UIImageView _setImage → CUINamedVectorGlyph _layerNamesForRenderingMode:inRendition: The termination reason: FRONTBOARD domain:10 code:0x8BADF00D Failed to terminate gracefully after 5.0s WatchdogEvent: process-exit WatchdogVisibility: Foreground Key observations: Only reproduces with AssistiveTouch enabled iPad Pro 11 (3rd gen), iPadOS 26 Our code i
Replies
3
Boosts
0
Views
4.0k
Activity
3w
Public API to overlay or hide the system keyboard while preserving its exact state?
I am building an iOS text composer with an attachment panel. When its UITextField is first responder and the system keyboard is visible, tapping the attachment button should present a panel that can extend into the region occupied by the keyboard. When the panel closes, the user should return to the same keyboard state without a visible dismissal and re-presentation. The required continuity is: The same UITextField remains first responder. The active input mode remains alphabet, 123, or Emoji. Emoji preserves its selected category, search state, and scroll position. The composer remains positioned above the keyboard throughout the transition. I have investigated the public UIKit approaches: A normal app-window overlay cannot render above the remotely hosted system keyboard. inputAccessoryView remains in the accessory region and cannot cover the keycaps. Resigning first responder visibly dismisses the keyboard and loses continuity. Assigning a custom inputView to the same UITextField and calling reloadInputVie
Replies
1
Boosts
0
Views
260
Activity
3w
Reply to Enhancing age-appropriate experiences
Hello @Bianca_, Thank you for your post. That's a good suggestion, however these forums are for questions about developing software and accessories for Apple platforms. If you would like to develop your own app that teaches literacy, these forums are a great place to ask questions – and SwiftUI contains accessible and easy to use frameworks for accomplishing this goal. Your question seems related to a consumer feature and is better suited as an Enhancement Request filed through Feedback Assistant. I would recommend to file an enhancement request, this way it goes to the relevant teams. I hope this information is helpful.  Travis
Replies
Boosts
Views
Activity
3w
Reply to CKShare save fails with BAD_REQUEST on _pcs_data in Production private database
Resolved. Two separate causes, neither visible from the client-side CKError. The Production schema was missing the system record type cloudkit.share. Enabling verbose error output in our own build surfaced the real server text: CKError 12 - Cannot create new type cloudkit.share in production schema CloudKit Console confirmed neither Development nor Production had cloudkit.share (only our own MedStatus and Users). This type cannot be created by hand in the console. It is auto-created the first time a share is actually saved in the DEVELOPMENT environment, and then must be pushed with Deploy Schema Changes. Our app had only ever run against Production (TestFlight / App Store builds), so that type was never created. The BAD_REQUEST on _pcs_data was the downstream symptom, not the cause. Fix: install a Debug build on a device (Development environment), perform one share, confirm cloudkit.share appears under Record Types, then Deploy Schema Changes to Production. Note for testing Production on-device: a Release co
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
3w
SwiftUI.AsyncRenderer crashes in ScrollView initializer.
I have a few crashes on my project that happen in the wild, and the stack trace looks like this, from a thread that is not the main thread: Crashed: com.apple.SwiftUI.AsyncRenderer 0 libdispatch.dylib 0x36f1c _dispatch_assert_queue_fail + 120 1 libdispatch.dylib 0x37988 dispatch_assert_queue$V2.cold.2 + 114 2 libdispatch.dylib 0x5094 dispatch_assert_queue + 108 3 libdispatch.dylib 0x5094 dispatch_assert_queue$V2 + 108 4 libswift_Concurrency.dylib 0xedfc _swift_task_checkIsolatedSwift + 48 5 libswift_Concurrency.dylib 0x6fc4 swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag) + 356 6 Xogot 0x2585a78 closure #1 in Toolbar3D.dockedBody.getter + 195 (Toolbar3D.swift:195) 7 SwiftUI 0xeae60 ScrollView.init(_:showsIndicators:content:) + 136 8 Xogot 0x2585798 Toolbar3D.body.getter + 207 (Toolbar3D.swift:207) 9 SwiftUICore 0x31614 closure #1 in ViewBodyAccessor.updateBody(of:changed:) + 1068 10 SwiftUICore 0x311b0 ViewBodyAccessor.updateBody(of:chang
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
166
Activity
3w
Reply to Add two new appearance options for Control Center: More Tinted and More Glass.
Hello @Mahmoudb, Have you tried iOS 27 beta? With the 27 releases, Liquid Glass has a refined look and automatically responds to the new Liquid Glass slider to adjust its tint. This means users can select the tint from a slider, try it out, let me know if it works for this goal. For more information, see What's New in SwiftUI - WWDC26  Travis
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
3w
Reply to macOS 27 Catalyst: WKWebView text entry impossible, endless keyboard input-view focus loop
Solved. Two things together cause it: .focusable() + .focused($isFocused) on the SwiftUI container holding the WKWebView. The app echoing the page's focus reports back into that state — page posts on focus/blur, app sets isFocused = true/false. Either alone types fine. A single focus drive at load does not reproduce; it has to be the echo. A plain is enough — not Monaco-specific. Fix: if #available(iOS 27, *) { content } else { content.focusable().focused($isFocused) } Correcting myself: a workaround does exist, and my earlier claim that -becomeFirstResponder re-arms an endless loop was measured with .focusable() still applied, so treat it as unverified. FB24092251 has a standalone repro project attached.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
3w
Pinch gesture not recognized on MTKView when attaching it to a RealityView using a ViewAttachmentComponent in a immersive space
Hello! We are seeing a problem with a SwiftUI view that wraps an MTKView and that MTKView uses gesture recognizers from UIKit. One of those gestures we are using is UIPinchGestureRecognizer. And that gesture isn’t recognized at all when the SwiftUI view is attached to a RealityView using the ViewAttachmentComponent AND the RealityView is being shown in an ImmersiveSpace. If the SwiftUI view is attached to the RealityView using the init that has an attachment closure then pinching works fine there. So this definitely seems like a bug. Here is some code to help you reproduce the problem. Run this on a Vision Pro device. A simple red square will be rendered and if a single tap or pinch gesture is recognized on the red square, it will print to the console. App Code: import SwiftUI @main struct VisionPinchProblemsApp: App { var body: some Scene { WindowGroup { MenuView() } ImmersiveSpace(id: RedSquare) { RedSquareView() } } } View code: import MetalKit import RealityKit import SwiftUI
Replies
1
Boosts
0
Views
631
Activity
3w
How to limit SwiftUI PasteButton for custom URLs?
For GNU Taler, we defined a custom URL scheme: taler://. We want to have a SwiftUI PasteButton in our app which is only active/enabled when the user copied a talerURI, but not for other URIs (such as https:// or mailto://). Currently we use PasteButton(supportedContentTypes: [.url]) { providers in which works, but is also enabled when the copied text is some other URI, not only for taler://. Can we define a UTType .taler for PasteButton to check whether the pasteBoard has indeed a talerURI? How?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
392
Activity
3w
How to make a layout like Android's StaggeredGridLayoutManager in SwiftUI
Hi everyone In SwiftUI, are there any good solutions to achieve a layout similar to Android's StaggeredGridLayoutManager for displaying a large amount of data?
Replies
1
Boosts
0
Views
187
Activity
3w
Intermittent UIHostingController layout regression after app launch on iPadOS 27 beta 4
On iPadOS 27.0 beta 4, SwiftUI views hosted inside UIKit-managed containers/overlays can be laid out incorrectly. The same app and same code work correctly on iPadOS 26.x release versions. One visible example is the app’s About dialog. The dialog is implemented as a UIKit UIViewController presented with UIModalPresentationFormSheet. Inside that controller, a UIHostingController is added as a child view controller, and the hosting controller’s view is constrained to all four edges of the parent view. The SwiftUI root view is a VStack containing the app icon, app name, version, text, links, and buttons. Expected behavior: The SwiftUI content should be vertically centered inside the form sheet. The app icon should appear above the app title, followed by the version, text, links, and buttons. This is the behavior on iPadOS 26.x. Actual behavior on iPadOS 27.0 beta 4: When the About dialog is opened immediately after launching the app, this issue occurs intermittently. The form sheet its
Replies
1
Boosts
0
Views
422
Activity
3w