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

UIKit Documentation

Posts under UIKit subtopic

Post

Replies

Boosts

Views

Activity

[iOS 26 beta] UIScene migration with loadFileURL:allowingReadAccessToURL: has partial rendering for app BG launch
We're currently migrating from AppDelegate to UISceneDelegate due to console warnings . Our application's UI, which is built on a single webpage, functions correctly when launched in the foreground after this migration. However, we've encountered an issue with partial rendered UI components when launching the application from the background, such as upon receiving a VoIP call. During a background launch, the following delegate calls occur before the client attempts to load a local webpage: [08/07 16:25:49:037][ 0x101ea3910]<ALA_SIGNAL>: [OS-PLT] Exit -[AppDelegate application:didFinishLaunchingWithOptions:] [08/07 16:25:49:084][ 0x10c0c4140]<PushToTalk> [Pushnotif] [] <ALA_SIGNAL>: [OS-CCF] Enter -[PushNotificationManager pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:] [08/07 16:25:49:098][ 0x101ea3910]Begin -[SceneDelegate scene:willConnectToSession:options:] [08/07 16:25:49:098][ 0x101ea3910]Exit -[SceneDelegate scene:willConnectToSession:options:] As part of client login process we load the index page in WebKit here: [08/07 16:25:50:977][ 0x101ea3910]<ALA_SIGNAL>: [PLT-OS] Enter -[SceneDelegate loadUI:] [UI Launch Reason = 1] Code: NSString *path = [[NSBundle mainBundle]pathForResource:@"index" ofType:@"html" inDirectory:@"www"]; NSURL *urlReq = [NSURL fileURLWithPath:path]; [webView loadFileURL:urlReq allowingReadAccessToURL:urlReq]; The problem we're observing is that the webpage is only partially rendering in this background launch scenario (Seen after brought to FG). Any insights or assistance you can provide would be greatly appreciated.
2
0
176
4w
Custom TabBar height in a production app – is this allowed?
Hi, I'm working on a large application, and the designers have proposed a new look for the tab bar. The app has been in development for 14 years, and while many views are now in SwiftUI, navigation between screens is still handled in UIKit, since most screens are still UIKit-based. Currently, we're using the native UIKit TabBar. I'm going to check if it's possible to customize the appearance of the native TabBar. However, I remember that over 10 years ago, when I changed the height of the TabBar, the app was rejected during review for not complying with Apple's Human Interface Guidelines. It looked something like this: An app rejection related to a tab bar's height update in Swift, likely due to not adhering to Apple's Human Interface Guidelines, can be addressed by ensuring the tab bar's height remains at the default 49 points and avoiding any modifications that don't align with the HIG, according to Apple's documentation. How does it look nowadays? Has anyone here submitted an app to the store with a heavily customized TabBar height and had it approved? In UIKit, I see it's possible to do something like this: https://stackoverflow.com/questions/23044218/change-uitabbar-height Would something like this pass app review without issues? Do you know of any apps that have a non-standard, significantly increased TabBar height?
0
0
74
4w
tabBarMinimizeBehavior no longer working after upgrading to Xcode 16 beta 5 / iOS 18 beta 5
Hello! The minimize behavior was working correctly while I was using Xcode 26 beta 4 with iOS 26 beta 4 simulator — when scrolling down, the Tab Bar would minimize as expected. However, after upgrading both Xcode and iOS simulator to beta 5, the tabBarMinimizeBehavior setting no longer has any visible effect — the Tab Bar stays fixed in place. Code snippet: if #available(iOS 26.0, *) { self.tabBarMinimizeBehavior = .onScrollDown } Steps to reproduce: 1. Create a UITabBarController with at least one tab containing a scrollable view (e.g., UITableView). 2. In viewDidLoad, set tabBarMinimizeBehavior to .onScrollDown. 3. Run on iOS 26 beta 5 simulator. Expected behavior (beta 4): Scrolling down hides/minimizes the Tab Bar with animation. Actual behavior (beta 5): Tab Bar remains fixed; no minimize animation is triggered. Environment: • Xcode 26 beta 5 (Build: 17A5295f) • iOS 26 beta 5 simulator (Build: 1055) – iPhone 16 Pro • Also tested on iPhone 13 mini – iOS 26 (Build: 23A5308g)
3
1
157
4w
Is there a tech note for menuBuilder?
I'm trying to piece together how I should reason about multiple windows, activating menus and items. For instance, I have an email command. If a document is open, it emails just that document. If the collection view holding that document is open, it generates an attachment representing the collection. (this happens with buttons right now but this really feels like a menu item) How do I tell which window is active (document/collection) in order to have the right menu item available. If the user is adding a document I don't want the "new" command open, I only want one editing view. I saw sample code to include or remove commands but not disable them. I feel like there's a whole conceptual layer I want to understand with the interplay with scenes but don't know where to look for documentation. I searched here but there's hardly any threads on this. TIA
Topic: UI Frameworks SubTopic: UIKit
7
0
127
Aug ’25
iOS 26 | UIBarButtonItem UI issues with isEnabled and hidesSharedBackground
UIBarButtonItem setting isEnabled = false, but the item is still tappable and animating. Is this a new UI behavior or an issue? Do the following steps: On tapping on a UIBarButtonItem, disable by setting isEnabled = false and setting hidesSharedBackground = true Enable the button by setting isEnabled = true and setting hidesSharedBackground = false => The button appears with bigger shared background is this an issue? please find the attachments for more details. ViewController.swift.txt
1
1
188
Aug ’25
iOS 26 UITabBar size issue
On iOS 26 not able to control size of UITabBar. Sharing code below. Colour is applying correctly but somehow _UITabBarPlatterView which turns out as TabBar is not extending; leaving spaces on left, right & bottom sides. class CustomTabBar: UITabBar { override init(frame: CGRect) { super.init(frame: frame) backgroundColor = .red let firstItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0) let secondItem = UITabBarItem(title: "Search", image: UIImage(systemName: "magnifyingglass"), tag: 1) let thirdItem = UITabBarItem(title: "Profile", image: UIImage(systemName: "person.circle"), tag: 2) items = [firstItem, secondItem, thirdItem] selectedItem = firstItem } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } class ViewController: UIViewController { let tabBar: CustomTabBar = { let tb = CustomTabBar() tb.translatesAutoresizingMaskIntoConstraints = false return tb }() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemBackground view.addSubview(tabBar) NSLayoutConstraint.activate([ tabBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 25), tabBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -25), tabBar.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) ]) } } when specifying height in CustomTabBar explicitly... func alignInternalSubViews() { subviews.forEach { subView in subView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ subView.topAnchor.constraint(equalTo: topAnchor), subView.leadingAnchor.constraint(equalTo: leadingAnchor), subView.trailingAnchor.constraint(equalTo: trailingAnchor), subView.bottomAnchor.constraint(equalTo: bottomAnchor), subView.heightAnchor.constraint(equalToConstant: 62) ]) } } What should I need to do in order to get this capsule _UITabBarPlatterView and its subviews resize accordingly?
3
0
204
Aug ’25
[iOS26 Bug] UITableView AutomaticDemension not respected unless backgroundColor is set
I discovered a layout issue in iOS 26 Beta that affects dynamic table view row height. When using rowHeight = UITableView.automaticDimension, the cell height is not calculated properly unless I explicitly set a backgroundColor (even .clear) on the cell or its contentView. This only occurs in iOS 26 Beta. Works fine in iOS 18 and earlier. You can find a sample project reproducing the issue here: 🔗 Sample Project on GitHub Conditions TableView rowHeight is set to .automaticDimension Cells use Auto Layout and have intrinsic content sizes No heightForRow override Setting self.backgroundColor = .clear in awakeFromNib() fixes the issue Questions Has anyone else experienced this? Could this be a bug in the new layout engine for iOS 26? Any official guidance? Also, if there’s something wrong or fragile about how I set up the layout, I’d appreciate any feedback! Thanks!
Topic: UI Frameworks SubTopic: UIKit
1
0
50
Aug ’25
New typed notifications for keyboards do not work?
@MainActor class KeyboardObserver { var token: NotificationCenter.ObservationToken! func registerObserver(screen: UIScreen) { let center = NotificationCenter.default token = center.addObserver(of: screen, for: .keyboardWillShow) { keyboardState in print("+++ Keyboard showed up!") } } } The notification is never called. The sample code from the sessions also does not work for me. let keyboardObserver = NotificationCenter.default.addObserver( of: UIScreen.self for: .keyboardWillShow ) { message in UIView.animate( withDuration: message.animationDuration, delay: 0, options: .flushUpdates ) { // Use message.endFrame to animate the layout of views with the keyboard let keyboardOverlap = view.bounds.maxY - message.endFrame.minY bottomConstraint.constant = keyboardOverlap } } @MainActor class KeyboardObserver { func registerObserver(screen: UIScreen) { let center = NotificationCenter.default let token = center.addObserver( of: screen, for: .keyboardWillShow ) { keyboardState in let startFrame = keyboardState.startFrame let endFrame = keyboardState.endFrame self.keyboardWillShow(startFrame: startFrame, endFrame: endFrame) } } func keyboardWillShow(startFrame: CGRect, endFrame: CGRect) {} }
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
75
Aug ’25
`awakeFromNib` and Approachable Concurrency
When attempting to compile an existing project with Swift 6, default isolation set to MainActor and approachable concurrency enabled, all awakeFromNib functions lead to the following compile error: "Main actor-isolated instance method 'awakeFromNib()' has different actor isolation from nonisolated overridden declaration" I've seen articles before approachable concurrency stating that one remedy is to wrap code within the function with MainActor.assumeIsolated{ }. However, that no longer addresses the error. One combination of changes that removes the error is doing the following: nonisolated override func awakeFromNib() { super.awakeFromNib() MainActor.assumeIsolated { ... } } Honestly, that's a mess. Long term, we are looking to remove all these functions, but does anyone have a better solution?
3
0
105
Aug ’25
How to customize the liquid glass tab bar appearance in iOS26?
I'm trying to customize the appearance of the liquid glass tab bar. Are these APIs deprecated in iOS 26? UITabBarAppearance: configureWithOpaqueBackground() -> would be nice to have an option to keep the shape/behavior but have an opaque background. backgroundColor -> should this be used both for setting the color of opaque background and tinting the liquid glass? selectionIndicatorTintColor, selectionIndicatorImage -> neither of these seem to do anything on either iOS 18 and 26 UITabBarItemAppearance: normal.iconColor -> doesn't seem to work, only selected.iconColor
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
112
Aug ’25
UIStoryboard.instantiateInitialViewController Not Working in iOS 18.6 When Built with iOS 26 SDK
In my SceneDelegate via 'scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)' I call the following code to assign a Storyboard: let storyboard = UIStoryboard(name: "Main", bundle: nil) let initialVC = storyboard.instantiateInitialViewController() self.window?.rootViewController = initialVC The Initial VC is a UITabBarController. The app crashes when calling 'instantiateInitialViewController': *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ because no class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' terminating due to uncaught exception of type NSException CoreSimulator 1047 - Device: iPhone 16 Pro (06A3EAF6-6623-49FD-BEFE-BE88FDD13BBE) - Runtime: iOS 18.6 (22G86) - DeviceType: iPhone 16 Pro Works fine in iOS 26 when compiling using Xcode 26. Works fine when compiling for iOS 18.6 in Xcode 16.4. Seems to just be an issue when using the iOS 26 SDK in iOS 18.6. This will be an issue for Day 01 Updates if a user hasn't updated to iOS 26 yet.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
71
Aug ’25
UISearchTab with automaticallyActivatesSearch only works on second tap?
let searchTab = UISearchTab { tab in UINavigationController(rootViewController: SearchViewController()) } searchTab.automaticallyActivatesSearch = true class SearchViewController: UIViewController { private let searchController = UISearchController(searchResultsController: UIViewController()) override func viewDidLoad() { super.viewDidLoad() navigationItem.searchController = searchController } } With this setup when I launch the app and tap the search tab, the keyboard will not appear. Switching tabs and tapping search again works from then on. Am I doing something wrong here? Video here: https://mastodon.social/@nicoreese/114983627125286299
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
77
Aug ’25
Why my link color changes back to system default on click and hold?
I currently have a custom UITextView that properly changes the color of a link to the custom color I have set, however, when I click and hold the link, and the animation plays that makes the link bigger and creates a boarder around the link before previewing the website, the link changes briefly back to the system default color, and when letting go, it changes back to my custom color. Is there anyway to have the link always be my custom color, even when clicking and holding? struct AutoDetectedClickableDataView: UIViewRepresentable { let text: String let dataDetectors: UIDataDetectorTypes @Binding var height: CGFloat private func dataDectectorValue(_ dataDectecor: UIDataDetectorTypes) -> UInt64 { var checkingTypes: [NSTextCheckingResult.CheckingType] = [] if dataDetectors.contains(.phoneNumber) { checkingTypes.append(.phoneNumber) } if dataDetectors.contains(.link) { checkingTypes.append(.link) } if dataDetectors.contains(.address) { checkingTypes.append(.address) } if dataDetectors.contains(.calendarEvent) { checkingTypes.append(.date) } if checkingTypes.isEmpty { return 0 } let intCheckingTypes: UInt64 = checkingTypes.reduce(0) { result, checkingType in UInt64(result) | UInt64(checkingType.rawValue) } return intCheckingTypes } func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.dataDetectorTypes = dataDetectors textView.isEditable = false textView.isScrollEnabled = false textView.backgroundColor = .clear textView.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.systemFont(ofSize: 16.0), compatibleWith: textView.traitCollection) textView.textColor = UIColor.label textView.adjustsFontForContentSizeCategory = true textView.textContainer.lineBreakMode = .byWordWrapping textView.textContainerInset = .zero textView.textContainer.lineFragmentPadding = 0 textView.translatesAutoresizingMaskIntoConstraints = false textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) textView.setContentHuggingPriority(.defaultHigh, for: .horizontal) textView.linkTextAttributes = [.foregroundColor: JeromesColors.UILinkColor] textView.tintColor = JeromesColors.UILinkColor for gesture in textView.gestureRecognizers ?? [] { if gesture is UITapGestureRecognizer { gesture.view?.tintColor = JeromesColors.UILinkColor } } return textView } func updateUIView(_ uiView: UITextView, context: Context) { let font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.systemFont(ofSize: 16.0), compatibleWith: uiView.traitCollection) let color = UIColor.label let attributed = NSMutableAttributedString(string: text, attributes: [ .font: font, .foregroundColor: color ]) let detectorValue = dataDectectorValue(dataDetectors) var matchCount = 0 if !dataDetectors.isEmpty, detectorValue != 0 { let detector = try? NSDataDetector(types: detectorValue) detector?.enumerateMatches(in: text, options: [], range: NSRange(location: 0, length: text.utf16.count)) { match, _, _ in guard let match = match else { return } if match.resultType == .date, let date = match.date, date < Date() { return } else { attributed.addAttributes([ .foregroundColor: JeromesColors.UILinkColor, .underlineStyle: NSUnderlineStyle.single.rawValue, ], range: match.range) matchCount += 1 } } } uiView.attributedText = attributed if matchCount == 0 { uiView.isSelectable = false } else if matchCount > 0 { uiView.isSelectable = true } DispatchQueue.main.async { uiView.layoutIfNeeded() let fittingSize = CGSize(width: uiView.bounds.width, height: .greatestFiniteMagnitude) let size = uiView.sizeThatFits(fittingSize) height = size.height } } }
0
0
38
Aug ’25
Trying to get UIBarButtonItem custom view to change color within iOS 26 Liquid Glass like native UIBarButtonItem
One of the bar button items of my bottom toolbar needs to be a custom view., and I’m trying hard to get it to behave like the proper bar button items when it comes to Liquid Glass and matching the appearance of all the other bar button items on my toolbar. I’ve tried many variations of embedding custom views within visual effect views, and this comes closest. I inited a UIBarButtonItem with a custom UIView like you’re supposed to, and then I placed a UIVisualEffectView with Vibrancy within that, so that I could place a UIImageView inside it and the UIImageView would respect the adaptive color changing that comes with being within a Liquid Glass bar button item. I’ve made sure that the UIImageView is using an SF Symbol and a rendering mode of .alwaysTemplate, and that the .tintColor is set to .label, to ensure that I’m not overriding any Liquid Glass rendering. Below, you can see the bar button item with my custom view on the left, and a native Bar Button Item with the same SF symbol on the right, in several scenarios. It gets part of the way there there: against light backgrounds the image view turns black like it should. But against darker backgrounds, instead of turning white, the symbol has an additional vibrancy that comes close to the right white look against certain grays, but then is obviously too translucent against black. The symbol is still visible/experiencing some vibrancy, so I assume it might be some configuration of the UIImageView within the Vibrancy that can correct the behavior to match the images in the native bar button items in all conditions. Anyone got thoughts on what the missing piece might be?
4
0
276
Aug ’25
Modal Presentation in UIKit Adds Solid Background in iOS 26
Hello, I have a number of UIViewControllers that are presented as follows: vc.modalPresentationStyle = UIModalPresentationStyle.popover vc.modalTransitionStyle = UIModalTransitionStyle.coverVertical self.present(vc, animated: true, completion: nil) The VC is designed from a Storyboard where I set the 'view' of the VC to have a .clear 'backgroundColor', I have a smaller 'Alert View' added as a subview which is what the user interacts with. In iOS 13 - iOS 18 this would present modally, not take up the entire screen and allow the user to see relevant context from the screen underneath. In iOS 26 Beta 5 and every beta prior the system injects a 'UIDropShadowView' in the View Hierarchy, this view has a solid color backdrop, either white/black depending on light/dark mode. This causes all underlying content to be blocked and essentially forces a full screen modal presentation despite the existing design. I am looking for a way to remove this solid color. I'm not sure if it's intentional or a bug / oversight. I have been able to remove it in a hacky way, I cycle the view hierarchy to find 'UIDropShadowView' and set it's backdrop to transparent. However when you swipe down to partially dismiss the view it turns to Liquid Glass when it is around 75% dismissed and then resets the background color to white/black. I tried creating a custom UIViewControllerTransitioningDelegate so that I could re-implement the existing behaviour but it's incredibly difficult to mimic the partial dismiss swipe down effect on the VC. I have also tried changing my presentation to: vc.modalPresentationStyle = UIModalPresentationStyle.overFullScreen vc.modalTransitionStyle = UIModalTransitionStyle.crossDissolve This works but then the user loses the ability to interactively swipe to dismiss. Any help would be appreciated. Thank you!
Topic: UI Frameworks SubTopic: UIKit Tags:
6
1
228
Aug ’25