I connected a tap gesture recogniser to a label in storyboard by dragging a tap gesture recogniser object onto the label. When I connect the outlet to the gesture recogniser I get this error:
How can I connect the tap gesture recogniser in storyboard to my code?
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Posts under UIKit tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I implement a custom keyboard extension. On modern iPhones the dictation button will display in the lower right even when a custom keyboard is active. If you are in an empty text field with the sentence capitalization trait turned on (e.g., Messages), press the Mic button, and dictate something, it will appear with the first word capitalized. As it should. But when you hit the Mic button again to accept the result, the first word is suddenly changed to uncapitalized. With the system keyboard this final case change does not occur.
Why? How to prevent this?
More technical detail: I receive UITextInputDelegate-textWillChange and UITextInputDelegate-textDidChange events during dictation (always with the textInput parameter set to nil) and then a final textDidChange with the lowercased text when accepting at the end.
I have a couple of (older) UIKit-based Apps using UISplitViewController on the iPad to have a two-column layout. I'm trying to edit the App so it will shows the left column as sidebar with liquid glass effect, similar to the one in the "Settings" App of iPadOS 26. But this seems to be almost impossible to do right now.
"out of the box" the UISplitViewController already shows the left column somehow like a sidebar, with some margins to the sides, but missing the glass effect and with very little contrast to the background. If the left column contains a UITableViewController, I can try to get the glass effect this way within the UITableViewController:
tableView.backgroundColor = .clear
tableView.backgroundView = UIVisualEffectView(effect: UIGlassContainerEffect())
It is necessary to set the backgroundColor of the table view to the clear color because otherwise the default background color would completely cover the glass effect and so it's no longer visible.
It is also necessary to set the background of all UITableViewCells to clear.
If the window is in the foreground, this will now look very similar to the sidebar of the Settings App.
However if the window is in the back, the sidebar is now much darker than the one of the Settings App. Not that nice looking, but for now acceptable.
However whenever I navigate to another view controller in the side bar, all the clear backgrounds destroy the great look, because the transition to the new child controller overlaps with the old parent controller and you see both at the same time (because of the clear backgrounds).
What is the best way to solve these issues and get a sidebar looking like the one of the Settings App under all conditions?
In iOS26, when using a standalone UITabBar without UITabBarController, the liquid glass blur effect is not applied when scrollable content moves behind the tab bar. However, the blur effect appears correctly when using UITabBarController.
Sample Screenshots:
When using UITababr
When using UITababrController
Sample Code:
class SimpleTabBarController: UIViewController, UITabBarDelegate {
let tabBar = UITabBar()
let redItem = UITabBarItem(title: "Red", image: .add, tag: 0)
let blueItem = UITabBarItem(title: "Blue", image: .checkmark, tag: 1)
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
tabBar.items = [redItem, blueItem]
tabBar.selectedItem = redItem
tabBar.delegate = self
tabBar.translatesAutoresizingMaskIntoConstraints = false
let tableContainerView = TableContainerView()
view.addSubview(tableContainerView)
tableContainerView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
tableContainerView.topAnchor.constraint(equalTo: view.topAnchor),
tableContainerView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
tableContainerView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableContainerView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
view.addSubview(tabBar)
NSLayoutConstraint.activate([
tabBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
tabBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tabBar.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
I'm working on a UIKit-based iOS app and would like to use the new GlassEffectContainer with liquid glass
effects introduced in iOS 26 beta.
Currently, I have two buttons (heart and comment) in a UIToolbar and want to wrap them in a glass effect container to get the morphing/blending effect when they're close together.
The API appears to be SwiftUI-only:
GlassEffectContainer
.glassEffect() modifier
Is there a UIKit equivalent, or is the recommended approach to embed a SwiftUI view using UIHostingController?
I'm already using UIVisualEffectView with UIGlassEffect elsewhere, but that doesn't provide the liquid morphing behavior between multiple views.
From, "Applying liquid glass" article:
GlassEffectContainer(spacing: 40.0) {
HStack(spacing: 40.0) {
Image(systemName: "scribble.variable")
.frame(width: 80.0, height: 80.0)
.font(.system(size: 36))
.glassEffect()
Image(systemName: "eraser.fill")
.frame(width: 80.0, height: 80.0)
.font(.system(size: 36))
.glassEffect()
// An `offset` shows how Liquid Glass effects react to each other in a container.
// Use animations and components appearing and disappearing to obtain effects that look purposeful.
.offset(x: -40.0, y: 0.0)
}
}
Thanks!
Hi,
There is new cornerConfiguration API introduced for UIVisualEffectView mentioned in tutorial below.
https://developer.apple.com/videos/play/wwdc2025/284/
But it is not available to use as of now. Using Xcode 26 Beta 2.
Please get it fixed.
My app encountered a crash problem. The analysis stack seems to be related to the keyboard. The system keyboard code is unresponsive for a long time until it crash. The feature of the stack, BrowserEngineKit, seems to indicate the webview scene. Xcode debugging found that tap the input box on the webview page can reproduce the same stack as the crash, but the crash cannot be reproduced. I noticed a feedback link https://developer.apple.com/forums/thread/784718, which is the same as the top of the crash stack I encountered, so the root cause of the problem may be similar, caused by the locking operation related to UIKeyboardTaskQueue. Hope to give some suggestions. Thanks.
crash log:
Incident Identifier: 39E3AFE6-43B1-4DE6-AC2B-D62C5EC89752
CrashReporter Key: AppleMetricKit
Hardware Model: iPhone17,2
Process: iAliexpress
Code Type: ARM-64
Parent Process: ? [1]
Date/Time: 2025-07-02 22:59:00
Launch Time: Unknown
OS Version: iPhone OS 18.1.1 (22B91)
Report Version: 104
Exception Type: EXC_CRASH
Exception Codes: KERN_SUCCESS
Triggered by Thread: 0
Application Specific Information:
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: app<com.alibaba.iAliexpress(A182346C-2A09-4082-9AAE-0EC7A1A1B5AB)>:2263 exhausted real (wall clock) time allowance of 10.00 seconds
ProcessVisibility: Unknown
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 15.280 (user 9.430, system 5.850), 25% CPU",
"Elapsed application CPU time (seconds): 0.210, 0% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001ea7f7f90 __psynch_cvwait :8 (in libsystem_kernel.dylib)
1 libsystem_pthread.dylib 0x000000022296aa7c _pthread_cond_wait :1248 (in libsystem_pthread.dylib)
2 Foundation 0x000000019908fa9c -[NSCondition waitUntilDate:] :132 (in Foundation)
3 Foundation 0x000000019908bea8 -[NSConditionLock lockWhenCondition:beforeDate:] :80 (in Foundation)
4 UIKitCore 0x000000019d05cbb4 -[UIKeyboardTaskQueue lockWhenReadyForMainThread] :784 (in UIKitCore)
5 UIKitCore 0x000000019d05c85c -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] :160 (in UIKitCore)
6 UIKitCore 0x000000019d56720c -[_UIKeyboardStateManager prepareForSelectionChange] :128 (in UIKitCore)
7 UIKitCore 0x000000019d5674f4 -[_UIKeyboardStateManager selectionWillChange:] :72 (in UIKitCore)
8 BrowserEngineKit 0x0000000257671688 -[BETextInteraction selectionWillChange:] :84 (in BrowserEngineKit)
9 UIKitCore 0x000000019d75d654 -[UIAsyncTextInteraction selectionWillChange:] :68 (in UIKitCore)
10 UIKitCore 0x000000019dbae374 -[_UIKeyboardTextSelectionController beginSelectionChange] :64 (in UIKitCore)
11 UIKitCore 0x000000019df5fed0 -[UITextSelectionInteraction tappedToPositionCursorWithGesture:atPoint:granularity:completionHandler:] :476 (in UIKitCore)
12 UIKitCore 0x000000019df5f948 -[UITextSelectionInteraction _checkForRepeatedTap:gestureLocationOut:] :1072 (in UIKitCore)
13 UIKitCore 0x000000019df60488 -[UITextSelectionInteraction _handleMultiTapGesture:] :852 (in UIKitCore)
14 UIKitCore 0x000000019cf879cc -[UIApplication sendAction:to:from:forEvent:] :100 (in UIKitCore)
15 UIKitCore 0x000000019d84ce98 -[UITextMultiTapRecognizer onStateUpdate:] :280 (in UIKitCore)
16 UIKitCore 0x000000019cfb6ac4 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] :128 (in UIKitCore)
17 UIKitCore 0x000000019cfb6934 _UIGestureRecognizerSendTargetActions :92 (in UIKitCore)
18 UIKitCore 0x000000019cfb66f4 _UIGestureRecognizerSendActions :284 (in UIKitCore)
19 UIKitCore 0x000000019cc69b28 -[UIGestureRecognizer _updateGestureForActiveEvents] :572 (in UIKitCore)
20 UIKitCore 0x000000019cc3b724 _UIGestureEnvironmentUpdate :2488 (in UIKitCore)
21 UIKitCore 0x000000019cd2fa00 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] :336 (in UIKitCore)
22 UIKitCore 0x000000019cecffe4 -[UIGestureEnvironment _updateForEvent:window:] :188 (in UIKitCore)
23 UIKitCore 0x000000019cecf3c8 -[UIWindow sendEvent:] :2948 (in UIKitCore)
24 iAliexpress 0x0000000104e92000 -[UIWindow(AliHA) aliHASwizzledSendEvent:] UIWindow+AliHA.m:18 (in iAliexpress)
25 UIKitCore 0x000000019cd63b70 -[UIApplication sendEvent:] :376 (in UIKitCore)
26 iAliexpress 0x0000000104e91c84 -[UIApplication(SPM) alg_sendEvent:] AFSPMManager.m:0 (in iAliexpress)
27 UIKitCore 0x000000019cd6409c __dispatchPreprocessedEventFromEventQueue :1048 (in UIKitCore)
28 UIKitCore 0x000000019cd6df3c __processEventQueue :5696 (in UIKitCore)
29 UIKitCore 0x000000019cc66c60 updateCycleEntry :160 (in UIKitCore)
30 UIKitCore 0x000000019cc649d8 _UIUpdateSequenceRun :84 (in UIKitCore)
31 UIKitCore 0x000000019cc64628 schedulerStepScheduledMainSection :172 (in UIKitCore)
32 UIKitCore 0x000000019cc6559c runloopSourceCallback :92 (in UIKitCore)
33 CoreFoundation 0x000000019a434328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ :28 (in CoreFoundation)
34 CoreFoundation 0x000000019a4342bc __CFRunLoopDoSource0 :176 (in CoreFoundation)
35 CoreFoundation 0x000000019a431dc0 __CFRunLoopDoSources0 :244 (in CoreFoundation)
36 CoreFoundation 0x000000019a430fbc __CFRunLoopRun :840 (in CoreFoundation)
37 CoreFoundation 0x000000019a430830 CFRunLoopRunSpecific :588 (in CoreFoundation)
38 GraphicsServices 0x00000001e64101c4 GSEventRunModal :164 (in GraphicsServices)
39 UIKitCore 0x000000019cf96eb0 -[UIApplication _run] :816 (in UIKitCore)
40 UIKitCore 0x000000019d0455b4 UIApplicationMain :340 (in UIKitCore)
41 iAliexpress 0x0000000104e9b0b8 _main main.m:17 (in iAliexpress)
42 dyld 0x00000001bfe1eec8 start :2724 (in dyld)
Under macOS 26 and iPadOS, the Help menu in many cases has a menu item for "App Help". This item has the following icon:
I need to use this in my own app. I am unable to find this icon in SF Symbols 7 beta. I've scanned all of the icons under "What's New". I've searched for "help", "light", and "bulb" and this icon does not appear.
Does anyone know if it's even a new SF Symbol? Or does anyone know of a way to use this icon?
We have an app that optionally includes UIKit, and in Xcode 16.3 it builds just fine, but with Xcode 26 it fails because it cannot find UIDefines.h.
Error:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS26.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:10:9: fatal error: 'UIUtilities/UIDefines.h' file not found
I looked for it, and inside of Xcode 26 there is a new folder(SubFrameworks) inside of the TV Simulator that does not exist in 18 and it only has one thing in that folder and it's UIUtilities.framework.
Reference path: /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/SubFrameworks/UIUtilities.framework/
Not sure how to get around this except to put in a bunch of new ifdefines maybe to deal with it, but it is weird that the subframeworks file is part of the issue. Anyone have any ideas besides copying the files over (doesn't work anyway)?
We are seeing crashes in Xcode organizer. So far we are not able to reproduce them locally. They affect multiple app releases (some older, built with Xcode 15.x and newer built with Xcode 16.0). They only affect iOS 18.5.
Is there anything that changed in latest iOS? It's hard to tell what exactly is causing this crash because setting symbolic breakpoint on CA::Render::Image::new_image(unsigned int, unsigned int, unsigned int, unsigned int, CGColorSpace*, void const*, unsigned long const*, void (*)(void const*, void*), void*) triggers this breakpoint all the time, but not necessarily with exactly the previous stack frames matching the crash report.
Is it a known issue?
crash.crash
Thank you.
How do you create a toolbar item using the standard system close button or prominent done (✔️) button in SwiftUI?
In UIKit UIBarButtonItem provides .close and .done system items, and to get the tinted checkmark for done you set style = .prominent.
Since iOS 26, hidesBottomBarWhenPushed no longer works.
We have numerous screens in our app which depend on being able to extend content to the bottom of the screen, and this feels like a bug.
Consider this example, running the exact same code across iOS 18 and iOS 26. On iOS 18, pushing the button pushes a view controller and the tab bar disappears, on iOS 26, however, pushing the view controller does not hide the tab bar.
I've filed this as FB18543961 and attached the sample project.
In iOS 26 there is a new way of displaying action sheets from the buttons that triggers them. I figured out that in SwiftUI you can just set the confirmationDialog view modifier on the button that triggers it.
However, I can't find a way to get this behavior in UIKit when a UIButton triggers an alert. Has anyone got this work?
The behavior is mentioned briefly in the "Get to know the new design system" session.
In iPadOS 26, Apple introduced macOS-style window control buttons (close, minimize, fullscreen) for iPad apps running in a floating window. I'm working on a custom toolbar (UIView) positioned near the top of the window, and I'd like to avoid overlapping with these new controls.
However, I haven't found any public API that exposes the frame, layout margins, or safe area insets related to this new UI region. I've checked the window's safeAreaInsets, additionalSafeAreaInsets, and UIWindowSceneDelegate APIs, but none of them seem to reflect the area occupied by these buttons.
Is there an officially supported way to:
Get the layout information (frame, insets, or margins) of the window control buttons on iPadOS 26?
Or, is there a system-defined guideline or padding value we should use to avoid overlapping this new UI?
Any clarification or guidance would be appreciated!
I have a game app for iOS and iPadOS, which expects a full screen experience. I'd like to out of window resizing in iPadOS 26 as it negatively impacts the UI/UX of the app. I have UIRequiresFullScreen defined, but it doesn't seem to actually force full screen on iPadOS 26 anymore.
Verbatim of a feedback report (FB18431713) I submitted, duplicated here since we can't see each other's feedbacks, and I wanted a centralized place to track the resolution of this as I'm surely not the only one facing this.
When building the app using Xcode 26 beta 2 and running it in an iOS 26 simulator, I'm experiencing a retain cycle in the UINavigationController.
From the data I saw in Xcode's memory graph debugger, it seems that _UIViewControllerOneToOneTransitionContext is retaining it. I base this on the fact that the line connecting a view controller and _UIViewControllerOneToOneTransitionContext has a "strong" reference, as indicated in Xcode. (However, I'm reporting this as a retain cycle in UINavigationController, as that's what seems to hold onto this transition-context.)
Hello,
I’m currently working on migrating an existing AppDelegate-based application to use the scene-based life cycle, as recommended in the TN3187 technical note.
As part of this process, I’ve been conducting some tests. After completely removing the scene-based setup (i.e., removing the UIApplicationSceneManifest from Info.plist and deleting SceneDelegate.swift), the app runs in a legacy AppDelegate-only life cycle as expected. In this case, lifecycle methods such as applicationWillEnterForeground and applicationDidEnterBackground in the AppDelegate are called properly. SceneDelegate methods are, naturally, not called—since the class is removed.
However, here’s where the confusion arises:
Even in this AppDelegate-only configuration, if I register for UIScene notifications via NotificationCenter, the corresponding selectors are invoked at runtime, which suggests that UIScene lifecycle notifications are still being broadcast internally by the system.
Below is the test code I used, along with console output:
func addObserver() {
NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
if #available(iOS 13.0, *) {
NotificationCenter.default.addObserver(self, selector: #selector(sceneDidEnterBackground), name: UIScene.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(sceneWillEnterForeground), name: UIScene.willEnterForegroundNotification, object: nil)
}
}
@objc
func sceneWillEnterForeground() {
print("sceneWillForeground")
}
@objc
func sceneDidEnterBackground() {
print("sceneDidEnterBackground")
}
@objc
func appWillEnterForeground() {
print("appWillEnterForeground")
}
@objc
func appDidEnterBackground() {
print("appDidEnterBackground")
}
sceneWillForeground
AppDelegate::willenterforeground
appWillEnterForeground
So, my question is:
Even in an AppDelegate-only app running on iOS 13 or later, is it expected behavior that UIScene lifecycle notifications such as UIScene.didEnterBackgroundNotification and UIScene.willEnterForegroundNotification are still posted by the system?
===
Additional Question:
The TN3187 note lists only four methods to migrate between AppDelegate and SceneDelegate. Are there any other lifecycle methods (beyond the four listed) that also require manual migration during this transition?
Thank you in advance for your insights.
We use several UIKit and AVFoundation APIs in our project, including:
setAlternateIconName(_:completionHandler:)
getAllTasks(completionHandler:)
loadMediaSelectionGroup(for:completionHandler:)
Moreover, we use the Swift Concurrency versions for these APIs:
@MainActor
func setAlternateIconName(_ alternateIconName: String?) async throws
var allTasks: [URLSessionTask] { get async }
func loadMediaSelectionGroup(for mediaCharacteristic: AVMediaCharacteristic) async throws -> AVMediaSelectionGroup?
Everything worked well with these APIs in Xcode 16.2 and earlier, but starting from Xcode 16.3 (and in 16.4), they cause crashes. We've rewritten the APIs to use completion blocks instead of async/await, and this approach works.
Stack traces:
setAlternateIconName(_:completionHandler:)
var allTasks: [URLSessionTask] { get async }
loadMediaSelectionGroup(for:completionHandler:)
Also, I attached some screenshots from Xcode 16.4.
func textField(
_ textField: UITextField,
shouldChangeCharactersIn range: NSRange,
replacementString string: String
) -> Bool {
if
let delegate = delegate,
let shouldChangeCharactersIn = delegate.textField {
return shouldChangeCharactersIn(textField, range, string)
}
return true
}
This is from an extension
extension TextInput: UITextFieldDelegate, ObservableTextFieldDelegateProtocol {
The delegate is already a UITextFieldDelegate, but when you click on the error, it returns 7 instances of:
"Found this candidate in module 'UIKit' (UIKit.UITextFieldDelegate.textField)"
This doesn't give an error in Xcode 16. Is this an Xcode 26 bug?
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (application.applicationState == UIApplicationStateBackground) {
// ✅ Background launch
} else {
// ✅ Normal foreground launch
}
}
Previously, when using AppDelegate to handle lifecycle methods, I could determine whether a cold start was a background launch as shown above. This allowed me to accurately measure cold start time for real-world users.
The platform now requires migration to scene-based lifecycle management by iOS 16. However, after migration:
In both application:didFinishLaunchingWithOptions: and scene:willConnectToSession:options: methods,
application.applicationState == UIApplicationStateBackground and scene.activationState == UISceneActivationStateUnattached
These values remain fixed regardless of whether it's a background launch, making them unusable for differentiation.
I attempted to use information from UISceneConnectionOptions for distinction but found it ineffective.
Question: Are there alternative approaches to achieve this distinction?