Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

Posts under UIKit tag

200 Posts

Post

Replies

Boosts

Views

Activity

Rotating iPhone to landscape mode causes previously hidden navigation bar of detail view to appear but navigation bar of sidebar to remain hidden
My app has a split view with a root view and a detail view, both of which are inside their own navigation view controller. The navigation bar of the detail view can be hidden to allow the user to stay more focused on the content. The problem is that when the navigation bar of the content view is hidden in portrait mode and the iPhone is rotated to landscape mode, the navigation bar of the content view becomes visible automatically and the sidebar appears on the left side, but the navigation bar of the sidebar is hidden. Is it expected that the navigation bar becomes visible automatically when rotating the device? Why is the navigation bar of the sidebar hidden? Is this related to hiding the navigation bar of the content view and why does this happen? What am I supposed to do so that the navigation bar of the sidebar remains visible at all times? For comparison the two cases: After rotation when navigation bar of content view was visible: After rotation when navigation bar of content view was hidden: import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window = UIWindow(windowScene: scene as! UIWindowScene) window!.rootViewController = SplitViewController() window!.makeKeyAndVisible() } } class SplitViewController: UISplitViewController, UISplitViewControllerDelegate { var detailNavigationViewController: UINavigationController! init() { super.init(nibName: nil, bundle: nil) detailNavigationViewController = UINavigationController(rootViewController: DetailViewController()) viewControllers = [UINavigationController(rootViewController: RootViewController())] } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func showDetail() { showDetailViewController(detailNavigationViewController, sender: nil) } } class RootViewController: UIViewController { override func loadView() { navigationItem.title = "Root" navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add) let button = UIButton(primaryAction: UIAction(handler: { [self] _ in (splitViewController as! SplitViewController).showDetail() })) button.setTitle("Show detail", for: .normal) button.translatesAutoresizingMaskIntoConstraints = false view = UIView() view.layer.backgroundColor = UIColor(white: 0.9, alpha: 1).cgColor view.addSubview(button) NSLayoutConstraint.activate([NSLayoutConstraint(item: button, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0), NSLayoutConstraint(item: button, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: 0)]) } } class DetailViewController: UIViewController { override func loadView() { navigationItem.title = "Detail" navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "sidebar.leading"), primaryAction: UIAction(handler: { _ in UIView.animate(withDuration: 0.3) { [self] in self.splitViewController!.preferredDisplayMode = .oneOverSecondary } })) navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add) let button = UIButton(primaryAction: UIAction(handler: { [self] _ in navigationController!.setNavigationBarHidden(!navigationController!.isNavigationBarHidden, animated: true) })) button.setTitle("Toggle navigation bar", for: .normal) button.translatesAutoresizingMaskIntoConstraints = false view = UIView() view.addSubview(button) NSLayoutConstraint.activate([NSLayoutConstraint(item: button, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0), NSLayoutConstraint(item: button, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: 0)]) } } I created FB24413608.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
172
3w
iOS 27 Beta: UISearchTab's search field ignores the horizontal safe area in landscape (correct on iOS 26)
On iOS 27 beta, when a search field hosted by a UISearchTab becomes active in landscape on a device with a sensor housing, the field lays out edge-to-edge, and its leading magnifier ends up inside the safe area inset. The same code is correct on iOS 26, so this looks like a regression. It then gives the environment, the setup (tabs API + UISearchTab with automaticallyActivatesSearch, plain UISearchController assigned in init, no placement or scrolling flags, no custom bar subclass), expected versus actual, and the measurements: window = 812 x 375, safeAreaInsets left/right 50 (usable 50…762) tab-hosted, active: field = (8.0, 122.0, 744.0, 44.0) ← 42pt inside the left inset tab-hosted, idle: field = (94.0, 311.0, 680.0, 44.0) ← trailing edge overruns by 12pt presented (no tabs): field = (101.7, 126.7, 553.0, 30.7) ← fully inside iOS 26 iOS 27 Not sure if it's known/has a supported workaround.
0
0
364
3w
Is the order of UIApplication.connectedScenes guaranteed across scene roles on iOS 27?
On iOS 27 beta 3, scene(_:willConnectTo:options:) is now called twice at launch — once for a .windowApplication scene, and once for a keyboard input scene (_UISceneSessionRoleKeyboardInputScene). On earlier iOS versions only the .windowApplication scene was delivered. Parts of my code read connectedScenes and take the first element, e.g.: UIApplication.shared.connectedScenes.first?.delegate as! SceneDelegate In my testing the .windowApplication scene is always first, so .first still works — but I can't find any documentation confirming this ordering. Questions: Is the order of connectedScenes guaranteed (is .windowApplication always first), or should it be treated as unordered? Should I instead always filter explicitly, e.g. first { $0 is UIWindowScene && $0.session.role == .windowApplication }? Is delivering the keyboard-input scene to the app's UIWindowSceneDelegate intended on iOS 27, or a beta artifact? FB24389661 (Ordering of UIApplication.connectedScenes not documented when multiple scene roles connect (iOS 27)
1
0
314
3w
NavigationBarBackButtonHidden(true) does not suppress system back button when a custom ToolbarItem is present — two back buttons render
When a view combines .navigationBarBackButtonHidden(true) with a custom ToolbarItem(placement: .navigationBarLeading) back button, both controls render side by side in the navigation bar — the system back button is not fully suppressed, only visually emptied. This appears to be related to the new Liquid Glass toolbar platter system introduced this cycle. Environment Xcode 27 beta 3 iOS Version : 27.0 Reproduces on: Simulator 16.0 (1063.4) SimulatorKit 955.7 CoreSimulator 1168 Steps to Reproduce Create a NavigationStack with a root view and a pushed detail view. On the detail view, set .navigationBarBackButtonHidden(true). Also add a custom back button via .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button { dismiss() } label: { HStack { Image(systemName: "chevron.backward"); Text("Back") } } } }. Expected Result Only the custom "Back" button (chevron + text) is visible. Actual Result Two back-button-shaped controls appear side by side: an empty/default system back button platter, and the custom "Back" button. Confirmed via Xcode's View Debugger (Debug ▸ View Debugging ▸ Capture View Hierarchy): two sibling UIPlatformGlassInteractionView nodes exist under NavigationBarPlatterContainer_v2 ▸ PlatterContainerHostingView. One wraps a bare, unlabeled _UIButtonBarButton (the system-generated back control); the other wraps a BarItemView containing the app's custom Button (chevron + "Back" text). Both are laid out as independent glass platters rather than being merged into one leading toolbar group. Minimal Reproducible Project Attached: [BackButtonDuplicationRepro.zip] — a stripped-down single-screen repro isolating just this behavior (no navigation stack customization, no third-party code). Related report This looks like the same underlying issue as thread 812048 ("Toolbar Rendering Bug — ToolbarItem Duplication when Back Button Hidden"), which an Apple DTS engineer has already responded to requesting a reproducible project — hopefully this attached project + View Debugger evidence helps move that along. Also potentially related: thread 814816 (hidesSharedBackground not working for backBarButtonItem), which points at the same general area of the new Liquid Glass toolbar/platter system.
0
0
166
3w
How to override 'userInterfaceStyle' of menus displayed by UIMainMenuSystem?
My app is themeable, and uses window.overrideUserInterfaceStyle to set the userInterfaceStyle independently from the system setting. This works great, except this does not change the userInterfaceStyle of the menus. So I'm occasionally experiencing light menus with a dark themed app, and vice versa. Question: how to override the userInterfaceStyle of the menus managed by UIMainMenuSystem?
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
759
3w
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
635
3w
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
220
3w
Some discussion on gestureRecognizers
I would appreciate some feedback on this simple technical point. When a gesture is defined in code, it is simply added to the view with myFirstView.addGestureRecognizer(someGesture) That's fine. But, if by mistake, the same gesture is added later to another view myOtherView.addGestureRecognizer(someGesture) myFirstView will not receive anymore the notification. That's well known and documented, because in fact the gesture references the view and can only reference one. So my point: this may be a bit misleading, as API let one believe that the gesture is attached to the view ; hence, why not attach to a second view ? wouldn't it be better to have API where view is explicitly "attached" to gesture ? someGesture.attach(to: myFirstView) Doing so, if I later someGesture.attach(to: myOtherView) it would be clearer I am changing the attached view. I noted that when we define a gesture in IB, we can only connect from the view to the gesture, not from gesture to the view which seems to follow the same logic. A simple extension does it: extension UITapGestureRecognizer { func attach(to view: UIView) { view.addGestureRecognizer(self) } } Any thought ? PS: I'm amazed by code completion. I just typed extension UITapGestureRecognizer { func attach(to view: UIView) and it completed automatically the code with view.addGestureRecognizer(self)
0
0
179
4w
iPadOS 27 Beta — Siri AI overlay causes no Scene lifecycle callbacks, starves BT data processing threads
Environment: iPadOS 27 Beta (Developer Beta) iPad with Bluetooth Classic (iAP2/ExternalAccessory) + BLE active session App uses UIKit, WKWebView, scene-based lifecycle Problem: When the user invokes the new Siri AI by long-pressing the power button while our app is in the foreground with an active Bluetooth Classic session, we observe: No scene lifecycle callbacks fire — no sceneWillResignActive, no sceneDidEnterBackground, nothing. We confirmed by logging every UISceneDelegate method. Main thread / data processing threads are starved for ~2 seconds, causing a backlog of incoming Bluetooth data. Our real-time data processing latency jumps from ~105ms to over 2,300ms within 2 seconds of Siri activation. CADisplayLink / requestAnimationFrame callbacks show a ~935ms gap coinciding with the Siri overlay appearance, then irregular intervals afterward. The Bluetooth Classic transport (ExternalAccessory/iAP2) remains physically connected throughout — the issue is purely host-side processing starvation. What we've ruled out: BLE link degradation: firmware-side diagnostics confirm 100% data delivery, 0 lost packets during the incident Memory pressure from our app: our process memory stays flat; system-available memory drops ~14 units externally Questions: Is the absence of sceneWillResignActive when Siri AI activates on iPadOS 27 intended behavior, or a beta bug? The new UIApplication.systemPrefersReducedResourceUsage property (iPadOS 27 beta) — is this intended to signal system overlays like Siri consuming resources? Does the corresponding systemPrefersReducedResourceUsageDidChangeNotification fire when Siri activates? Are there recommended patterns for apps with real-time Bluetooth data processing to maintain thread priority during system overlays? We currently use default QoS for our data processing dispatch queues. The processing starvation causes the waveform display to degrade (appears as a connectivity issue to the clinician) even though the wireless link is healthy. We need either: A notification that a system overlay is active, so we can adjust our UI accordingly Guidance on maintaining processing priority during Siri AI activation Any community insight on workarounds would be highly appreciated. Thanks.
2
0
1k
4w
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
372
4w
Menu presentation in UIHostingController issues
Looking to see if anyone has experienced this issue, and is aware of any workarounds. With an app migrating towards SwiftUI Views but still using UIKit for primary navigation, my app makes use of UIHostingController to push SwiftUI Views onto a UINavigationController stack in a lot of areas. With iOS 26, I notice that SwiftUI's Menu view really struggles to present when contained in a UIHostingController. An error is logged to the console on presentation, and depending on the UI, the Menu won't present inside of it's container, or will jump around the screen. The bug, it seems is based in a private class UIReparentingView and I am curious if anyone has found a work around for this issue. The error reported is: Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead. The simplest way to see this issue is to create a new storyboard based project. From the ViewController present a UIHostingController with a SwiftUI view that has a Menu and then simply tap to open the Menu. Thanks for any input!
8
7
1.8k
4w
Unexpected lifecycle callback sequence when pressing the top button to put iPad to sleep on iPadOS 27 beta
Hello, I found a difference in application lifecycle behavior between iPadOS 26.5 and iPadOS 27 beta when the app is running in the foreground and the iPad top button is pressed to put the device into sleep. Test condition Device: iPad App state: app is running in foreground (active) Action: press the top button once to put the device to sleep Observed via UIApplicationDelegate lifecycle callbacks Observed behavior iPadOS 26.5 The following callbacks are called in this order: applicationWillResignActive applicationDidEnterBackground iPadOS 27 beta The following callbacks are called in this order: applicationWillResignActive applicationDidBecomeActive applicationWillResignActive applicationDidEnterBackground Expected behavior I expected the lifecycle sequence on iPadOS 27 beta to be the same as, or at least consistent with, iPadOS 26.5 when the device is put to sleep from the foreground app state. In particular, I did not expect applicationDidBecomeActive to be called during the transition to sleep/background. Question Is this changed behavior expected in iPadOS 27 beta, or could this be a bug in the beta? If this is expected, could you clarify the intended lifecycle behavior when the top button is pressed and the device transitions to sleep? Thank you.
1
0
389
Aug ’26
Emoji rotated variation
Emoji are very convenient to be used instead of image, directly as String. In some cases, a variation to show them rotated (but still as String, not converted as image) would be useful. Examples may be arrows or flags if you need to show them floating from the top and not from the side of the pole. And I would declare: flag = "🇺🇸" or So the question; is it possible to generate new emoji as rotated initial emojis ? Or better, do such extensions already exist.
3
1
2.3k
Aug ’26
Images in segmentedControl segments do not draw properly
This is UIKit app, in Xcode 26.3 (but same issue in 16.4). I create (in IB) a segmentedControl, with 2 segments. I set the images that are stored in assets. They show properly in Xcode. But when running (26.1 simulator), they just show a black image. In Xcode                                                                           On simulator at runtime I've tried to set background to clear as well as tint, to no avail. What am I missing ?
5
0
550
Aug ’26
Clarification on UIScene lifecycle requirement timing and Xcode adoption deadline
Hello, our team is currently in the process of adapting our app for UIScene lifecycle and Liquid Glass. When building with Xcode 26 and iOS 27 Simulator, we see the following message in the console: "UIScene life cycle is now required when building with the latest SDKs. Apps that don't adopt will fail to launch." If we build the app with Xcode 27 without scenes implemented, it crashes on launch as expected. To plan our development roadmap, we would like to clarify the following: 1. Behavior of Xcode 26 builds: Can builds created with Xcode 26 (without UIScene support) still be submitted to the App Store, and will they continue to launch without crashing for users updating to future iOS versions? 2. Xcode 26 submission deadline: Until what exact date will Apple continue accepting App Store submissions built with Xcode 26? Thank you for your guidance!
0
0
583
Aug ’26
iOS 27 Beta 4: Native Liquid Glass UITabBar renders with opaque milky/frosted background while identical code renders correctly on iOS 26.5
iOS 27 Beta 4: Native Liquid Glass UITabBar renders with opaque milky/frosted background while identical code renders correctly on iOS 26.5 Environment Xcode 27 Beta 4 iOS 27 Beta 4 UIKit UITabBarController Storyboard based application Native UITabBar (no custom tab bar implementation) Device: iPhone 17 Pro Simulator (also reproducible on other iPhone simulators) Problem After upgrading to iOS 27 Beta 4, the native Liquid Glass tab bar appears significantly more opaque (milky/frosted gray) than on iOS 26.5. The exact same application binary and configuration render correctly on iOS 26.5. No custom blur or visual effect is being applied. Current Configuration let appearance = UITabBarAppearance() appearance.configureWithDefaultBackground() appearance.backgroundColor = nil appearance.backgroundEffect = nil appearance.shadowColor = .clear tabBar.standardAppearance = appearance tabBar.scrollEdgeAppearance = appearance tabBar.isTranslucent = true tabBar.backgroundColor = nil tabBar.barTintColor = nil tabBar.backgroundImage = nil tabBar.shadowImage = nil Runtime Verification Verified at runtime: tabBar.backgroundColor == nil tabBar.barTintColor == nil tabBar.isTranslucent == true standardAppearance.backgroundColor == nil standardAppearance.backgroundEffect == nil scrollEdgeAppearance.backgroundColor == nil scrollEdgeAppearance.backgroundEffect == nil View Hierarchy The runtime hierarchy contains Apple's native Liquid Glass implementation: UITabBar _UIBarItemPlatterView _UILiquidLensView BackdropView ClearGlassView _UIPortalView _UITabSelectionView Therefore UIKit is using the Liquid Glass implementation rather than falling back to a legacy blur. Investigation Performed The following were tested without changing behavior: Removed all custom blur views Removed custom overlays Removed refresh/recomposition code Removed layout invalidation Removed transform hacks Removed PageMenu Replaced entire first tab with a plain UITableViewController Replaced DiscoverVC completely Replaced nested collection views Rebuilt a minimal demo project using identical UITabBarAppearance code The minimal demo renders correctly. The production application renders with a much more opaque gray background. Question Has anything changed in the Liquid Glass compositor or backdrop sampling behavior in iOS 27 Beta 4? Is there any new API or recommended configuration required to achieve the same transparency level as iOS 26.5? If this is expected behavior, is there any supported way to control the opacity of the system Liquid Glass material? Screenshots Attach: iOS 26.5 screenshot iOS 27 Beta 4 screenshot
1
0
711
Aug ’26
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 import UIKit struct MenuView: View { @Environment(\.openImmersiveSpace) private var openImmersiveSpace @Environment(\.dismissImmersiveSpace) private var dismissImmersiveSpace @State private var showImmersiveSpace = false @State private var immersiveSpaceIsOpen = false var body: some View { Form { Toggle("Show red square", isOn: $showImmersiveSpace) .task(id: showImmersiveSpace) { if showImmersiveSpace { await openImmersiveSpace(id: "RedSquare") immersiveSpaceIsOpen = true } else { if immersiveSpaceIsOpen { await dismissImmersiveSpace() immersiveSpaceIsOpen = false } } } } .onDisappear { // Attempt to close the immersive space on the way out. Task { if immersiveSpaceIsOpen { await dismissImmersiveSpace() } } } } } struct RedSquareView: View { let metalViewAttachmentID = "metalID" var body: some View { // Adds SwiftUI view using attachments closure. // Pinching and single taps are recognized here! // RealityView { content, attachments in // if let metalViewEntity = attachments.entity(for: metalViewAttachmentID) { // metalViewEntity.position = [0, 1, -1.25] // content.add(metalViewEntity) // } // } placeholder: { // ProgressView() // } attachments: { // Attachment(id: metalViewAttachmentID) { // MetalView() // } // } // Add SwiftUI view using ViewAttachmentComponent. // Pinching is not recognized here! // Single tapping is recognized ! // Why doesn't the red square show up in the Vision Pro simulator? RealityView { content in let metalViewEntity = Entity() let metalView = MetalView() .frame(width: 500, height: 500) let component = ViewAttachmentComponent(rootView: metalView) metalViewEntity.components.set(component) metalViewEntity.position = [0, 1, -1.25] content.add(metalViewEntity) } placeholder: { ProgressView() } } } struct MetalView: UIViewRepresentable { var device: MTLDevice? init() { self.device = MTLCreateSystemDefaultDevice() } func makeUIView(context: Context) -> MTKView { let mtkView = MTKView() mtkView.device = device mtkView.clearColor = MTLClearColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0) mtkView.delegate = context.coordinator let pinchGesture = UIPinchGestureRecognizer(target: context.coordinator, action: #selector(context.coordinator.handlePinch(_:))) mtkView.addGestureRecognizer(pinchGesture) let tapGesture = UITapGestureRecognizer(target: context.coordinator, action: #selector(context.coordinator.handleTap(_:))) mtkView.addGestureRecognizer(tapGesture) return mtkView } func updateUIView(_ uiView: MTKView, context: Context) { } func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, MTKViewDelegate { var parent: MetalView init(_ parent: MetalView) { self.parent = parent } func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) { } func draw(in view: MTKView) { guard let drawable = view.currentDrawable else { return } guard let descriptor = view.currentRenderPassDescriptor else { return } let commandQueue = parent.device?.makeCommandQueue() let commandBuffer = commandQueue?.makeCommandBuffer() let renderEncoder = commandBuffer?.makeRenderCommandEncoder(descriptor: descriptor) renderEncoder?.endEncoding() commandBuffer?.present(drawable) commandBuffer?.commit() } @objc func handlePinch(_ sender: UIPinchGestureRecognizer) { print("Pinch detected") } @objc func handleTap(_ sender: UITapGestureRecognizer) { print("Tap detected") } } }
1
0
795
Aug ’26
Rotating iPhone to landscape mode causes previously hidden navigation bar of detail view to appear but navigation bar of sidebar to remain hidden
My app has a split view with a root view and a detail view, both of which are inside their own navigation view controller. The navigation bar of the detail view can be hidden to allow the user to stay more focused on the content. The problem is that when the navigation bar of the content view is hidden in portrait mode and the iPhone is rotated to landscape mode, the navigation bar of the content view becomes visible automatically and the sidebar appears on the left side, but the navigation bar of the sidebar is hidden. Is it expected that the navigation bar becomes visible automatically when rotating the device? Why is the navigation bar of the sidebar hidden? Is this related to hiding the navigation bar of the content view and why does this happen? What am I supposed to do so that the navigation bar of the sidebar remains visible at all times? For comparison the two cases: After rotation when navigation bar of content view was visible: After rotation when navigation bar of content view was hidden: import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window = UIWindow(windowScene: scene as! UIWindowScene) window!.rootViewController = SplitViewController() window!.makeKeyAndVisible() } } class SplitViewController: UISplitViewController, UISplitViewControllerDelegate { var detailNavigationViewController: UINavigationController! init() { super.init(nibName: nil, bundle: nil) detailNavigationViewController = UINavigationController(rootViewController: DetailViewController()) viewControllers = [UINavigationController(rootViewController: RootViewController())] } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func showDetail() { showDetailViewController(detailNavigationViewController, sender: nil) } } class RootViewController: UIViewController { override func loadView() { navigationItem.title = "Root" navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add) let button = UIButton(primaryAction: UIAction(handler: { [self] _ in (splitViewController as! SplitViewController).showDetail() })) button.setTitle("Show detail", for: .normal) button.translatesAutoresizingMaskIntoConstraints = false view = UIView() view.layer.backgroundColor = UIColor(white: 0.9, alpha: 1).cgColor view.addSubview(button) NSLayoutConstraint.activate([NSLayoutConstraint(item: button, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0), NSLayoutConstraint(item: button, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: 0)]) } } class DetailViewController: UIViewController { override func loadView() { navigationItem.title = "Detail" navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "sidebar.leading"), primaryAction: UIAction(handler: { _ in UIView.animate(withDuration: 0.3) { [self] in self.splitViewController!.preferredDisplayMode = .oneOverSecondary } })) navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add) let button = UIButton(primaryAction: UIAction(handler: { [self] _ in navigationController!.setNavigationBarHidden(!navigationController!.isNavigationBarHidden, animated: true) })) button.setTitle("Toggle navigation bar", for: .normal) button.translatesAutoresizingMaskIntoConstraints = false view = UIView() view.addSubview(button) NSLayoutConstraint.activate([NSLayoutConstraint(item: button, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0), NSLayoutConstraint(item: button, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: 0)]) } } I created FB24413608.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
2
Boosts
0
Views
172
Activity
3w
iOS 27 Beta: UISearchTab's search field ignores the horizontal safe area in landscape (correct on iOS 26)
On iOS 27 beta, when a search field hosted by a UISearchTab becomes active in landscape on a device with a sensor housing, the field lays out edge-to-edge, and its leading magnifier ends up inside the safe area inset. The same code is correct on iOS 26, so this looks like a regression. It then gives the environment, the setup (tabs API + UISearchTab with automaticallyActivatesSearch, plain UISearchController assigned in init, no placement or scrolling flags, no custom bar subclass), expected versus actual, and the measurements: window = 812 x 375, safeAreaInsets left/right 50 (usable 50…762) tab-hosted, active: field = (8.0, 122.0, 744.0, 44.0) ← 42pt inside the left inset tab-hosted, idle: field = (94.0, 311.0, 680.0, 44.0) ← trailing edge overruns by 12pt presented (no tabs): field = (101.7, 126.7, 553.0, 30.7) ← fully inside iOS 26 iOS 27 Not sure if it's known/has a supported workaround.
Replies
0
Boosts
0
Views
364
Activity
3w
Is the order of UIApplication.connectedScenes guaranteed across scene roles on iOS 27?
On iOS 27 beta 3, scene(_:willConnectTo:options:) is now called twice at launch — once for a .windowApplication scene, and once for a keyboard input scene (_UISceneSessionRoleKeyboardInputScene). On earlier iOS versions only the .windowApplication scene was delivered. Parts of my code read connectedScenes and take the first element, e.g.: UIApplication.shared.connectedScenes.first?.delegate as! SceneDelegate In my testing the .windowApplication scene is always first, so .first still works — but I can't find any documentation confirming this ordering. Questions: Is the order of connectedScenes guaranteed (is .windowApplication always first), or should it be treated as unordered? Should I instead always filter explicitly, e.g. first { $0 is UIWindowScene && $0.session.role == .windowApplication }? Is delivering the keyboard-input scene to the app's UIWindowSceneDelegate intended on iOS 27, or a beta artifact? FB24389661 (Ordering of UIApplication.connectedScenes not documented when multiple scene roles connect (iOS 27)
Replies
1
Boosts
0
Views
314
Activity
3w
NavigationBarBackButtonHidden(true) does not suppress system back button when a custom ToolbarItem is present — two back buttons render
When a view combines .navigationBarBackButtonHidden(true) with a custom ToolbarItem(placement: .navigationBarLeading) back button, both controls render side by side in the navigation bar — the system back button is not fully suppressed, only visually emptied. This appears to be related to the new Liquid Glass toolbar platter system introduced this cycle. Environment Xcode 27 beta 3 iOS Version : 27.0 Reproduces on: Simulator 16.0 (1063.4) SimulatorKit 955.7 CoreSimulator 1168 Steps to Reproduce Create a NavigationStack with a root view and a pushed detail view. On the detail view, set .navigationBarBackButtonHidden(true). Also add a custom back button via .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button { dismiss() } label: { HStack { Image(systemName: "chevron.backward"); Text("Back") } } } }. Expected Result Only the custom "Back" button (chevron + text) is visible. Actual Result Two back-button-shaped controls appear side by side: an empty/default system back button platter, and the custom "Back" button. Confirmed via Xcode's View Debugger (Debug ▸ View Debugging ▸ Capture View Hierarchy): two sibling UIPlatformGlassInteractionView nodes exist under NavigationBarPlatterContainer_v2 ▸ PlatterContainerHostingView. One wraps a bare, unlabeled _UIButtonBarButton (the system-generated back control); the other wraps a BarItemView containing the app's custom Button (chevron + "Back" text). Both are laid out as independent glass platters rather than being merged into one leading toolbar group. Minimal Reproducible Project Attached: [BackButtonDuplicationRepro.zip] — a stripped-down single-screen repro isolating just this behavior (no navigation stack customization, no third-party code). Related report This looks like the same underlying issue as thread 812048 ("Toolbar Rendering Bug — ToolbarItem Duplication when Back Button Hidden"), which an Apple DTS engineer has already responded to requesting a reproducible project — hopefully this attached project + View Debugger evidence helps move that along. Also potentially related: thread 814816 (hidesSharedBackground not working for backBarButtonItem), which points at the same general area of the new Liquid Glass toolbar/platter system.
Replies
0
Boosts
0
Views
166
Activity
3w
How to override 'userInterfaceStyle' of menus displayed by UIMainMenuSystem?
My app is themeable, and uses window.overrideUserInterfaceStyle to set the userInterfaceStyle independently from the system setting. This works great, except this does not change the userInterfaceStyle of the menus. So I'm occasionally experiencing light menus with a dark themed app, and vice versa. Question: how to override the userInterfaceStyle of the menus managed by UIMainMenuSystem?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
3
Boosts
0
Views
759
Activity
3w
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
635
Activity
3w
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
220
Activity
3w
Some discussion on gestureRecognizers
I would appreciate some feedback on this simple technical point. When a gesture is defined in code, it is simply added to the view with myFirstView.addGestureRecognizer(someGesture) That's fine. But, if by mistake, the same gesture is added later to another view myOtherView.addGestureRecognizer(someGesture) myFirstView will not receive anymore the notification. That's well known and documented, because in fact the gesture references the view and can only reference one. So my point: this may be a bit misleading, as API let one believe that the gesture is attached to the view ; hence, why not attach to a second view ? wouldn't it be better to have API where view is explicitly "attached" to gesture ? someGesture.attach(to: myFirstView) Doing so, if I later someGesture.attach(to: myOtherView) it would be clearer I am changing the attached view. I noted that when we define a gesture in IB, we can only connect from the view to the gesture, not from gesture to the view which seems to follow the same logic. A simple extension does it: extension UITapGestureRecognizer { func attach(to view: UIView) { view.addGestureRecognizer(self) } } Any thought ? PS: I'm amazed by code completion. I just typed extension UITapGestureRecognizer { func attach(to view: UIView) and it completed automatically the code with view.addGestureRecognizer(self)
Replies
0
Boosts
0
Views
179
Activity
4w
iPadOS 27 Beta — Siri AI overlay causes no Scene lifecycle callbacks, starves BT data processing threads
Environment: iPadOS 27 Beta (Developer Beta) iPad with Bluetooth Classic (iAP2/ExternalAccessory) + BLE active session App uses UIKit, WKWebView, scene-based lifecycle Problem: When the user invokes the new Siri AI by long-pressing the power button while our app is in the foreground with an active Bluetooth Classic session, we observe: No scene lifecycle callbacks fire — no sceneWillResignActive, no sceneDidEnterBackground, nothing. We confirmed by logging every UISceneDelegate method. Main thread / data processing threads are starved for ~2 seconds, causing a backlog of incoming Bluetooth data. Our real-time data processing latency jumps from ~105ms to over 2,300ms within 2 seconds of Siri activation. CADisplayLink / requestAnimationFrame callbacks show a ~935ms gap coinciding with the Siri overlay appearance, then irregular intervals afterward. The Bluetooth Classic transport (ExternalAccessory/iAP2) remains physically connected throughout — the issue is purely host-side processing starvation. What we've ruled out: BLE link degradation: firmware-side diagnostics confirm 100% data delivery, 0 lost packets during the incident Memory pressure from our app: our process memory stays flat; system-available memory drops ~14 units externally Questions: Is the absence of sceneWillResignActive when Siri AI activates on iPadOS 27 intended behavior, or a beta bug? The new UIApplication.systemPrefersReducedResourceUsage property (iPadOS 27 beta) — is this intended to signal system overlays like Siri consuming resources? Does the corresponding systemPrefersReducedResourceUsageDidChangeNotification fire when Siri activates? Are there recommended patterns for apps with real-time Bluetooth data processing to maintain thread priority during system overlays? We currently use default QoS for our data processing dispatch queues. The processing starvation causes the waveform display to degrade (appears as a connectivity issue to the clinician) even though the wireless link is healthy. We need either: A notification that a system overlay is active, so we can adjust our UI accordingly Guidance on maintaining processing priority during Siri AI activation Any community insight on workarounds would be highly appreciated. Thanks.
Replies
2
Boosts
0
Views
1k
Activity
4w
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
372
Activity
4w
iOS 27 Beta UIBarButtonItem isHidden/isEnabled not working
I set the flag isHidden to true and isEnabled to false, but seems both of them are not working on iOS 27 public beta. They were working fine on iOS 26 and priors. Will next version iOS 27 fix that or do i need to use another alternative like completely remove the uibarbuttonitem from the navigation tool bar?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
3
Boosts
0
Views
957
Activity
4w
Menu presentation in UIHostingController issues
Looking to see if anyone has experienced this issue, and is aware of any workarounds. With an app migrating towards SwiftUI Views but still using UIKit for primary navigation, my app makes use of UIHostingController to push SwiftUI Views onto a UINavigationController stack in a lot of areas. With iOS 26, I notice that SwiftUI's Menu view really struggles to present when contained in a UIHostingController. An error is logged to the console on presentation, and depending on the UI, the Menu won't present inside of it's container, or will jump around the screen. The bug, it seems is based in a private class UIReparentingView and I am curious if anyone has found a work around for this issue. The error reported is: Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead. The simplest way to see this issue is to create a new storyboard based project. From the ViewController present a UIHostingController with a SwiftUI view that has a Menu and then simply tap to open the Menu. Thanks for any input!
Replies
8
Boosts
7
Views
1.8k
Activity
4w
App Startup with Debugger in Xcode 26 is slow
My app start up has became horrid. It takes 1 minute to open SQLlite database for my rust core. Impossible to work... I have Address Sanitizer, Thread Perf Checker and Thread Sanitizer disabled...
Replies
27
Boosts
6
Views
4.2k
Activity
Aug ’26
Unexpected lifecycle callback sequence when pressing the top button to put iPad to sleep on iPadOS 27 beta
Hello, I found a difference in application lifecycle behavior between iPadOS 26.5 and iPadOS 27 beta when the app is running in the foreground and the iPad top button is pressed to put the device into sleep. Test condition Device: iPad App state: app is running in foreground (active) Action: press the top button once to put the device to sleep Observed via UIApplicationDelegate lifecycle callbacks Observed behavior iPadOS 26.5 The following callbacks are called in this order: applicationWillResignActive applicationDidEnterBackground iPadOS 27 beta The following callbacks are called in this order: applicationWillResignActive applicationDidBecomeActive applicationWillResignActive applicationDidEnterBackground Expected behavior I expected the lifecycle sequence on iPadOS 27 beta to be the same as, or at least consistent with, iPadOS 26.5 when the device is put to sleep from the foreground app state. In particular, I did not expect applicationDidBecomeActive to be called during the transition to sleep/background. Question Is this changed behavior expected in iPadOS 27 beta, or could this be a bug in the beta? If this is expected, could you clarify the intended lifecycle behavior when the top button is pressed and the device transitions to sleep? Thank you.
Replies
1
Boosts
0
Views
389
Activity
Aug ’26
Emoji rotated variation
Emoji are very convenient to be used instead of image, directly as String. In some cases, a variation to show them rotated (but still as String, not converted as image) would be useful. Examples may be arrows or flags if you need to show them floating from the top and not from the side of the pole. And I would declare: flag = "🇺🇸" or So the question; is it possible to generate new emoji as rotated initial emojis ? Or better, do such extensions already exist.
Replies
3
Boosts
1
Views
2.3k
Activity
Aug ’26
Images in segmentedControl segments do not draw properly
This is UIKit app, in Xcode 26.3 (but same issue in 16.4). I create (in IB) a segmentedControl, with 2 segments. I set the images that are stored in assets. They show properly in Xcode. But when running (26.1 simulator), they just show a black image. In Xcode                                                                           On simulator at runtime I've tried to set background to clear as well as tint, to no avail. What am I missing ?
Replies
5
Boosts
0
Views
550
Activity
Aug ’26
Clarification on UIScene lifecycle requirement timing and Xcode adoption deadline
Hello, our team is currently in the process of adapting our app for UIScene lifecycle and Liquid Glass. When building with Xcode 26 and iOS 27 Simulator, we see the following message in the console: "UIScene life cycle is now required when building with the latest SDKs. Apps that don't adopt will fail to launch." If we build the app with Xcode 27 without scenes implemented, it crashes on launch as expected. To plan our development roadmap, we would like to clarify the following: 1. Behavior of Xcode 26 builds: Can builds created with Xcode 26 (without UIScene support) still be submitted to the App Store, and will they continue to launch without crashing for users updating to future iOS versions? 2. Xcode 26 submission deadline: Until what exact date will Apple continue accepting App Store submissions built with Xcode 26? Thank you for your guidance!
Replies
0
Boosts
0
Views
583
Activity
Aug ’26
iOS 27 Beta 4: Native Liquid Glass UITabBar renders with opaque milky/frosted background while identical code renders correctly on iOS 26.5
iOS 27 Beta 4: Native Liquid Glass UITabBar renders with opaque milky/frosted background while identical code renders correctly on iOS 26.5 Environment Xcode 27 Beta 4 iOS 27 Beta 4 UIKit UITabBarController Storyboard based application Native UITabBar (no custom tab bar implementation) Device: iPhone 17 Pro Simulator (also reproducible on other iPhone simulators) Problem After upgrading to iOS 27 Beta 4, the native Liquid Glass tab bar appears significantly more opaque (milky/frosted gray) than on iOS 26.5. The exact same application binary and configuration render correctly on iOS 26.5. No custom blur or visual effect is being applied. Current Configuration let appearance = UITabBarAppearance() appearance.configureWithDefaultBackground() appearance.backgroundColor = nil appearance.backgroundEffect = nil appearance.shadowColor = .clear tabBar.standardAppearance = appearance tabBar.scrollEdgeAppearance = appearance tabBar.isTranslucent = true tabBar.backgroundColor = nil tabBar.barTintColor = nil tabBar.backgroundImage = nil tabBar.shadowImage = nil Runtime Verification Verified at runtime: tabBar.backgroundColor == nil tabBar.barTintColor == nil tabBar.isTranslucent == true standardAppearance.backgroundColor == nil standardAppearance.backgroundEffect == nil scrollEdgeAppearance.backgroundColor == nil scrollEdgeAppearance.backgroundEffect == nil View Hierarchy The runtime hierarchy contains Apple's native Liquid Glass implementation: UITabBar _UIBarItemPlatterView _UILiquidLensView BackdropView ClearGlassView _UIPortalView _UITabSelectionView Therefore UIKit is using the Liquid Glass implementation rather than falling back to a legacy blur. Investigation Performed The following were tested without changing behavior: Removed all custom blur views Removed custom overlays Removed refresh/recomposition code Removed layout invalidation Removed transform hacks Removed PageMenu Replaced entire first tab with a plain UITableViewController Replaced DiscoverVC completely Replaced nested collection views Rebuilt a minimal demo project using identical UITabBarAppearance code The minimal demo renders correctly. The production application renders with a much more opaque gray background. Question Has anything changed in the Liquid Glass compositor or backdrop sampling behavior in iOS 27 Beta 4? Is there any new API or recommended configuration required to achieve the same transparency level as iOS 26.5? If this is expected behavior, is there any supported way to control the opacity of the system Liquid Glass material? Screenshots Attach: iOS 26.5 screenshot iOS 27 Beta 4 screenshot
Replies
1
Boosts
0
Views
711
Activity
Aug ’26
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 import UIKit struct MenuView: View { @Environment(\.openImmersiveSpace) private var openImmersiveSpace @Environment(\.dismissImmersiveSpace) private var dismissImmersiveSpace @State private var showImmersiveSpace = false @State private var immersiveSpaceIsOpen = false var body: some View { Form { Toggle("Show red square", isOn: $showImmersiveSpace) .task(id: showImmersiveSpace) { if showImmersiveSpace { await openImmersiveSpace(id: "RedSquare") immersiveSpaceIsOpen = true } else { if immersiveSpaceIsOpen { await dismissImmersiveSpace() immersiveSpaceIsOpen = false } } } } .onDisappear { // Attempt to close the immersive space on the way out. Task { if immersiveSpaceIsOpen { await dismissImmersiveSpace() } } } } } struct RedSquareView: View { let metalViewAttachmentID = "metalID" var body: some View { // Adds SwiftUI view using attachments closure. // Pinching and single taps are recognized here! // RealityView { content, attachments in // if let metalViewEntity = attachments.entity(for: metalViewAttachmentID) { // metalViewEntity.position = [0, 1, -1.25] // content.add(metalViewEntity) // } // } placeholder: { // ProgressView() // } attachments: { // Attachment(id: metalViewAttachmentID) { // MetalView() // } // } // Add SwiftUI view using ViewAttachmentComponent. // Pinching is not recognized here! // Single tapping is recognized ! // Why doesn't the red square show up in the Vision Pro simulator? RealityView { content in let metalViewEntity = Entity() let metalView = MetalView() .frame(width: 500, height: 500) let component = ViewAttachmentComponent(rootView: metalView) metalViewEntity.components.set(component) metalViewEntity.position = [0, 1, -1.25] content.add(metalViewEntity) } placeholder: { ProgressView() } } } struct MetalView: UIViewRepresentable { var device: MTLDevice? init() { self.device = MTLCreateSystemDefaultDevice() } func makeUIView(context: Context) -> MTKView { let mtkView = MTKView() mtkView.device = device mtkView.clearColor = MTLClearColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0) mtkView.delegate = context.coordinator let pinchGesture = UIPinchGestureRecognizer(target: context.coordinator, action: #selector(context.coordinator.handlePinch(_:))) mtkView.addGestureRecognizer(pinchGesture) let tapGesture = UITapGestureRecognizer(target: context.coordinator, action: #selector(context.coordinator.handleTap(_:))) mtkView.addGestureRecognizer(tapGesture) return mtkView } func updateUIView(_ uiView: MTKView, context: Context) { } func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, MTKViewDelegate { var parent: MetalView init(_ parent: MetalView) { self.parent = parent } func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) { } func draw(in view: MTKView) { guard let drawable = view.currentDrawable else { return } guard let descriptor = view.currentRenderPassDescriptor else { return } let commandQueue = parent.device?.makeCommandQueue() let commandBuffer = commandQueue?.makeCommandBuffer() let renderEncoder = commandBuffer?.makeRenderCommandEncoder(descriptor: descriptor) renderEncoder?.endEncoding() commandBuffer?.present(drawable) commandBuffer?.commit() } @objc func handlePinch(_ sender: UIPinchGestureRecognizer) { print("Pinch detected") } @objc func handleTap(_ sender: UITapGestureRecognizer) { print("Tap detected") } } }
Replies
1
Boosts
0
Views
795
Activity
Aug ’26
Customizing the spell checker red dots
Is there a way you can customize the look of the red dots? to offset the position or the size of the dots etc.?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
269
Activity
Aug ’26