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
177
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
211
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
107
Aug ’25
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
76
Aug ’25
New 'badge' property of UIBarButtonItem does not work in iOS 26 beta 3 when used in a toolbar
I'm very happy with the new badge property of UIBarButtonItem, but unfortunately it doesn't work yet on a UIToolbar object. The following code does change the tint color of the button to pink, which proves the button object exists, but there is no visible badge after running the code: if let button = toolbarItems?.first { button.badge = .count(123) // Does nothing button.tintColor = .systemPink // Works } Do I overlook something, or is this just not implemented yet? Or is this limitation 'by design'? (That would be a MAJOR disappointment)
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
116
Aug ’25
Trying to use UIScrollEdgeElementContainerInteraction
I have a UIKit app with a custom navigation controller. I want my view title to go up into the navigation bar when the user scrolls down the screen. It looks like UIScrollEdgeElementContainerInteraction should do what I want, but I am having trouble using it. Below is a sample, where a header view represents a title. I added the interaction to the header view, but it seems to have no effect. Am I missing a step? Perhaps I misunderstand what this is supposed to do, or perhaps I do not understand the preconditions to make this work. I am hoping someone can tell me what I am doing wrong, or point me to some working sample code. Thank you. John class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { var headerView: UIVisualEffectView! var tableView: UITableView! var interaction: UIScrollEdgeElementContainerInteraction! override func viewDidLoad() { super.viewDidLoad() self.tableView = UITableView() self.tableView.translatesAutoresizingMaskIntoConstraints = false self.tableView.topEdgeEffect.style = .soft self.tableView.delegate = self self.tableView.dataSource = self self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") self.view.addSubview(self.tableView) self.view.addConstraints([ self.tableView.topAnchor.constraint(equalTo: self.view.topAnchor), self.tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), self.tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), self.tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), ]) self.headerView = UIVisualEffectView(effect: UIGlassEffect(style: .regular)) self.headerView.translatesAutoresizingMaskIntoConstraints = false self.headerView.backgroundColor = .green self.view.addSubview(self.headerView) self.view.addConstraints([ self.headerView.topAnchor.constraint(equalTo: self.view.topAnchor), self.headerView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), self.headerView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), self.headerView.heightAnchor.constraint(equalToConstant: 100.0), ]) let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.text = "my text" self.headerView.contentView.addSubview(label) self.headerView.contentView.addConstraints([ label.centerXAnchor.constraint(equalTo: self.headerView.contentView.centerXAnchor), label.centerYAnchor.constraint(equalTo: self.headerView.contentView.centerYAnchor), ]) self.interaction = UIScrollEdgeElementContainerInteraction() self.interaction.scrollView = self.tableView self.interaction.edge = .top self.headerView.addInteraction(self.interaction) } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 100 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) cell.textLabel?.text = "row \(indexPath.row + 1)" return cell } }
Topic: UI Frameworks SubTopic: UIKit Tags:
7
0
150
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
53
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
72
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
280
Aug ’25
Xcode 26 beta iOS 16 crash Symbol not found: _UIMenuAutoFill
when launch my app from the Xcode 26 beta on iOS 16 I get this crash: Referenced from: <BB79205B-F03B-382A-A5D7-3F0C8A3135E5> /private/var/containers/Bundle/Application/7C842707-BB01-4C34-A2E0-318DC6E5B3D8/My APP.app/My APP.debug.dylib Expected in: <44798FBF-5AD6-37FB-A58C-DE1B58F2A2E7> /System/Library/Frameworks/UIKit.framework/UIKit Symbol not found: _UIMenuAutoFill Referenced from: <BB79205B-F03B-382A-A5D7-3F0C8A3135E5> /private/var/containers/Bundle/Application/7C842707-BB01-4C34-A2E0-318DC6E5B3D8/My APP.app/My APP.debug.dylib Expected in: <44798FBF-5AD6-37FB-A58C-DE1B58F2A2E7> /System/Library/Frameworks/UIKit.framework/UIKit dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
Topic: UI Frameworks SubTopic: UIKit Tags:
5
0
79
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
78
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
116
Aug ’25
Large title is not visible in iOS 26
I am using below code to change navigationBar bg colour, but the text is hidden in large title. It works fine in previous versions. Kindly refer below code and attached images. Code: override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.navigationBar.prefersLargeTitles = true navigationItem.largeTitleDisplayMode = .always let appearance = UINavigationBarAppearance() appearance.backgroundColor = UIColor( red: 0.101961, green: 0.439216, blue: 0.388235, alpha: 1.0 ) navigationController?.navigationBar.standardAppearance = appearance navigationController?.navigationBar.scrollEdgeAppearance = appearance navigationController?.navigationBar.compactAppearance = appearance } Referenced images:
3
2
201
Aug ’25
A bug in iOS 26 on UISegmentedControl
On iOS 26 beta 4 segmented control is not working properly when created via xib. When selecting, text is disappearing . Here is the link where it shows bug with a video. https://www.reddit.com/r/Xcode/comments/1m9n9qi/xcode_and_os_26_beta_4_liquid_glass_ui_still_has/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Topic: UI Frameworks SubTopic: UIKit
2
0
104
Aug ’25
App no longer runs in latest Xcode 26 Beta 4 17A5285i
Since installing the latest Xcode Beta (version 26.0 beta 4 17A5285i), it no longer runs my app on iPhone 11 and also not on iPad 10.2, both running iOS 18.5. The following code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ... // Preload both Tabbar Views NSArray* tabViewControllers = _tabBarController.viewControllers; _firstViewCntrl = (FirstViewController *)[tabViewControllers objectAtIndex:0]; _secndViewCntrl = (SecondViewController *)[tabViewControllers objectAtIndex:1]; UIView *dummy1 __unused; UIView *dummy2 __unused; dummy2 = _secndViewCntrl.view; // Triggers viewDidLoad <<<<< CRASH will crash the app (the problem is with the 'view' attribute): *** 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)' When I instead choose the Simulator (iPhone 16 Rosetta) as a destination, the app runs fine and the above assignment will trigger the viewDidLoad method of the second ViewController. So the Rosetta simulator runs fine, but the physical device fails. The debugger console illustrates the differences between stable and beta Xcode versions (both on physical device): Xcode Version 16.4 (16F6) from AppStore (app runs fine): (lldb) p _secndViewCntrl.view (UIView *) 0x0000000108366d00 Xcode Beta version 26.0 beta 4 17A5285i (app now crashes): (lldb) p _secndViewCntrl.view error: Execution was interrupted, reason: internal ObjC exception breakpoint(-9).. The process has been returned to the state before expression evaluation. Any ideas?
Topic: UI Frameworks SubTopic: UIKit
4
0
266
Aug ’25
On iPadOS 26 beta, the navigation bar can appear inset underneath the status bar (FB18241928)
On iPadOS 26 beta, the navigation bar can appear inset underneath the status bar (FB18241928) This bug does not happen on iOS 18. This bug occurs when a full screen modal view controller without a status bar is presented, the device orientation changes, and then the full screen modal view controller is dismissed. This bug appears to happen only on iPad, and not on iPhone. This bug happens both in the simulator and on the device. Thank you for investigating this issue.
6
0
321
Aug ’25