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

iOS 26: Tab Bar Item's accessibility value not set automatically anymore
We recently adopted our app to Liquid Glass and received a complaint from a visually impaired user that VoiceOver does not read out the number of unread items in the tab bar anymore. We checked and it seems that before iOS 26/Liquid Glass, setting a tab bar item's badgeValue property also set an appropriate text to its accessibilityValue property (something like "3 items"). But with Liquid Glass tab bars, this does not seem to be the case anymore. We fixed this by providing our own accessibility value, but we're wondering whether this change was a deliberate choice or simply a bug? If this new behavior is considered a bug, I would post a bug report.
1
0
181
12h
Putting 2 existing pdf pages side by side (half size) in a new pdf
In Swift, iOS, I have a pdf file. I want to take the pages 2 by 2 and put them side by side, on the new page. For this, I have to scale initial pages half size and rotate .pi/2. I managed to achieve this by converting pdf pages to UIImages and using a UIGraphicsImageRenderer. But with a critical loss of resolution. I've tried improving the resolution by creating images as jpegData(withCompressionQuality: 1.0), to no avail. So I would need to work directly on the pdf pages using CGPDFDocument format. The code structure is as follows, to insert a single scaled page: for iPage in … { if let _page = theCGPdfDocument.page(at: 1) { var _pageRect: CGRect = _page.getBoxRect(CGPDFBox.mediaBox) writeContextInDestination!.beginPage(mediaBox: &_pageRect) // translate to compensate for the flip caused displacement writeContextInDestination!.translateBy(x: _pageRect.size.width, y: _pageRect.size.height) Scale (-1, -1) // rotate 180° // add rotate as needed writeContextInDestination!.scaleBy(x: -1, y: -1) writeContextInDestination!.clip(to: _pageRect) writeContextInDestination!.drawPDFPage(_page) writeContextInDestination!.endPage() // end the current page } } writeContextInDestination!.closePDF() But I do not succeed in inserting the drawing of the second page. I've tried repeating lines 7 to 11 for a second page at line 13. No success. What is the direction to look for ?
0
0
21
17h
How to Reload Collection View (DiffableDataSource) after API Finishes Calling
Hello, I have a collection view that uses a diffable data source, and I am initiating an API call while configuring a cell RuntimeCell in the cell registration block inside setupDataSource(). The cell has a runtimeLabel property whose text I am setting inside a configureLabel(movieId:) function. I noticed that the collection view does not automatically refresh the text label once this API call finishes and after setting the text property on a UILabel in the collection view cell to a value retrieved during the API call. I presume this is because I need to call dataSource.apply(snapshot) myself to reload the changes in the collection view after the API call finishes retrieving the runtime data. However, since the API call happens via the configuration of the cell in the cell registration closure, this API call ends up being called infinitely if I call dataSource.apply(snapshot) every time the API call finishes (i.e. calling dataSource.applySnapshot() calls the closure for the cell registration handler which re-triggers the API call). What is the correct architecture to apply to accomplish reloading the collection view so that the text label appears once the API finishes calling? Thank you class MovieDetailViewController: UIViewController { func setupDataSource() { // ... let runTimeCellRegistration = UICollectionView.CellRegistration<RuntimeCell, Item> { cell, indexPath, item in cell.runtimeLabelDelegate = self cell.configureLabel(movieId: self.selectedMovie.id) } dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView, cellProvider: { collectionView, indexPath, itemIdentifier in let section = Section(rawValue: indexPath.section) switch section { //... case .runtime: return collectionView.dequeueConfiguredReusableCell(using: runTimeCellRegistration, for: indexPath, item: itemIdentifier) //... } return nil }) } } protocol RuntimeLabelCellDelegate: AnyObject { func didUpdateRuntime() } class RuntimeCell: UICollectionViewCell { var runtimeLabel: UILabel! //... UI Setup func configureLabel(movieId: Int) { Task { do { let details = try await movieSearchService.fetchMovieDetails(movieId: movieId) await MainActor.run { let minutes = details.runTime let durationText = "\(minutes)m" var emojiText = "" if minutes < 90 { emojiText = "Short & Sweet ⚡️" } else if minutes > 150 { emojiText = "Get the snacks ready 🍿" } runtimeLabel.text = emojiText.isEmpty ? durationText : "\(durationText) • \(emojiText)" runtimeLabelDelegate?.didUpdateRuntime() } } catch { print("Failed to load details: \(error)") } } } } extension MovieDetailViewController: RuntimeLabelCellDelegate { func didUpdateRuntime() { var snapshot = dataSource.snapshot() snapshot.appendItems([.runtime], toSection: .runtime) dataSource.apply(snapshot, animatingDifferences: true) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
59
2d
NSURL Does Not Honor NSURLHasHiddenExtensionKey When I set it via -setResourceValue:forKey:error:
I set the value of NSURLHasHiddenExtensionKey. I provide a textfield to rename a file and I set this flag based on whether the user has deleted or left on the path extension. So -setResourceValue:forKey:error: returns YES, does not populate the error, but does not honor the value I just set it to. I'm always setting it off the main thread on the same serial queue. Works the first time I rename the file then it just starts failing (silently). For example: NSError *setError = nil; if ([theURL setResourceValue:@(NO) forKey:NSURLHasHiddenExtensionKey error:&setError]) { [theURL removeAllCachedResourceValues]; NSNumber *freshRead = nil; NSError *getError = nil; if ([theURL getResourceValue:&freshRead forKey:NSURLHasHiddenExtensionKey error:&getError]) { if (freshRead.boolValue) { NSLog(@"it is yes when it should be NO."); } } if (getError != nil) { NSLog(@"Get error: %@",getError); } } if (setError != nil) { NSLog(@"Set error: %@",setError); } While I get that it is possible for there to be other apps setting this value at the same time as my app, doesn't really seem possible in my local environment right now. No errors log out but "it is yes when it should be NO." does log out.
1
0
48
4d
UIScrollView Layout issue
I run into a layout problem where I cannot center an image inside ScrollView which is also inside Navigation Controller. The problem is surely the fact that there is a navigation bar because using this view without NavigationContoller works fine and the image is centered but I don’t know how to account for the space that navigation bar takes up. Here is the code: import UIKit class PhotoViewController: UIViewController { var photoName: String private lazy var photoView = { let image = UIImageView() image.translatesAutoresizingMaskIntoConstraints = false image.contentMode = .scaleAspectFit image.clipsToBounds = true return image }() var photoViewBottomConstraint: NSLayoutConstraint? var photoViewLeadingConstraint: NSLayoutConstraint? var photoViewTopConstraint: NSLayoutConstraint? var photoViewTrailingConstraint: NSLayoutConstraint? private lazy var scrollView = { let sv = UIScrollView() sv.translatesAutoresizingMaskIntoConstraints = false return sv }() override func viewDidLoad() { super.viewDidLoad() setupUI() } override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() updateMinZoomScaleForSize(view.bounds.size) } func updateMinZoomScaleForSize(_ size: CGSize) { let widthScale = size.width / photoView.bounds.width let heightScale = size.height / photoView.bounds.height let minScale = min(widthScale, heightScale) scrollView.minimumZoomScale = minScale scrollView.zoomScale = minScale } func setupUI() { photoView.image = UIImage(named: photoName) scrollView.delegate = self view.addSubview(scrollView) scrollView.addSubview(photoView) setupConstraints() } func setupConstraints() { NSLayoutConstraint.activate([ scrollView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), scrollView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) ]) photoViewLeadingConstraint = NSLayoutConstraint( item: photoView, attribute: .leading, relatedBy: .equal, toItem: scrollView, attribute: .leading, multiplier: 1, constant: 0 ) photoViewTopConstraint = NSLayoutConstraint( item: photoView, attribute: .top, relatedBy: .equal, toItem: scrollView, attribute: .top, multiplier: 1, constant: 0 ) photoViewTrailingConstraint = NSLayoutConstraint( item: photoView, attribute: .trailing, relatedBy: .equal, toItem: scrollView, attribute: .trailing, multiplier: 1, constant: 0 ) photoViewBottomConstraint = NSLayoutConstraint( item: photoView, attribute: .bottom, relatedBy: .equal, toItem: scrollView, attribute: .bottom, multiplier: 1, constant: 0 ) photoViewLeadingConstraint?.isActive = true photoViewTopConstraint?.isActive = true photoViewTrailingConstraint?.isActive = true photoViewBottomConstraint?.isActive = true } init(photoName: String) { self.photoName = photoName super.init(nibName: nil, bundle: nil) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } extension PhotoViewController: UIScrollViewDelegate { func viewForZooming(in scrollView: UIScrollView) -> UIView? { photoView } func scrollViewDidZoom(_ scrollView: UIScrollView) { updateConstraintsForSize(view.bounds.size) } func updateConstraintsForSize(_ size: CGSize) { let yOffset = max(0, (size.height - photoView.frame.height) / 2) photoViewTopConstraint?.constant = yOffset photoViewBottomConstraint?.constant = yOffset let xOffset = max(0, (size.width - photoView.frame.width) / 2) photoViewLeadingConstraint?.constant = xOffset photoViewTrailingConstraint?.constant = xOffset view.layoutIfNeeded() } }
3
0
153
6d
UIActivityViewController not vertically scrollable when sharing CSV on specific device (Save option unreachable)
Platform UIKit iOS UIActivityViewController Environment Device (issue reported): iPhone 16 iOS Version: 26.2 App Type: UIKit / Swift (standard modal presentation of UIActivityViewController) Summary When presenting UIActivityViewController to share a CSV file, the share sheet does not allow vertical scrolling, making lower actions (including Save to Files) unreachable. The same flow works correctly when sharing a PDF, and the issue cannot be reproduced on other test devices. Steps to Reproduce Launch the app and log in Navigate to More → Reports Tap Export Report Choose Export Report (CSV) Observe the share sheet Expected Result The user should be able to vertically scroll the share sheet All share actions (including Save to Files) should be reachable Actual Result Share sheet opens but vertical scrolling is disabled Lower options (including Save to Files) are not reachable No crash or console errors
3
0
319
1w
Wrong appearance of decimalPad keyboard in dark mode
Hi. The following code causes UI mismatch on iOS26. Keyboard with type decimalPad and appearance as dark is displayed as popUp with wrong colors. Before iOS26 keyboard was regular with correct color scheme. Please advice either how to make the scheme correct or force to display regular keyboard instead of popup. class ViewController: UIViewController { @IBOutlet weak var textField: UITextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. textField.keyboardType = .decimalPad textField.keyboardAppearance = .dark view.backgroundColor = .darkGray } }
0
0
54
1w
navigationItem.titleView shifted left when leftBarButtonItem is nil in iOS 26
iOS 26 – navigationItem.titleView shifted left when leftBarButtonItem is nil Hi everyone, I’m encountering a layout issue on iOS 26 related to navigationItem.titleView positioning. What I’m Doing I’m hiding the default back button and removing the left bar button item: navigationItem.leftBarButtonItem = nil navigationItem.hidesBackButton = true navigationItem.setLeftBarButtonItems([], animated: true) Then I create a custom titleView with a specific width calculated as: Screen width minus the width of the two bar button items (left and right). let titleView = UIView(frame: CGRect(origin: .zero, size: sizeOfTitleView)) let titleLabel = UILabel(frame: CGRect(origin: .zero, size: sizeOfTitleView)) Expected Behavior On previous iOS versions, the titleView is perfectly centered in the navigation bar. Actual Behavior (iOS 26) On iOS 26, when leftBarButtonItem is nil, the titleView is pushed slightly to the left instead of being centered (see attached image). Question Has there been a change in UINavigationBar layout behavior in iOS 26? What is the correct way to ensure the titleView remains perfectly centered when there is no leftBarButtonItem? Any guidance would be appreciated. Thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
87
1w
UITrackingElementWindowController crash when viewDidDisappear on iPadOS26.1
hello, I have been receiving crash reports on iPadOS 26.1, When UITrackingElementWindowController viewDidDisappear The feedback associated with this post is: FB20986398 and Exception Exception 'Cannot remove an observer <PKTextEffectsWindowObserver 0x10854cbe0> for the key path "frame" from <UITextEffectsWindow 0x10827ca00> because it is not registered as an observer.' #1 0x0000000183529814 in objc_exception_throw () #2 0x00000001845065a4 in -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] () #3 0x00000001845069c8 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] () #4 0x00000001845068e0 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] () #5 0x00000001cb22e894 in -[PKTextEffectsWindowObserver dealloc] () #6 0x000000018beafb28 in _setInteractionView () #7 0x000000018d81e8b8 in -[UIView(Dragging) removeInteraction:] () #8 0x00000001cb216448 in -[PKTextInputInteraction willMoveToView:] () #9 0x000000018beafb1c in _setInteractionView () #10 0x000000018d81e8b8 in -[UIView(Dragging) removeInteraction:] () #11 0x000000018d5ab094 in -[UIEditingOverlayViewController _removeInteractions] () #12 0x000000018cb166a8 in -[UIViewController _setViewAppearState:isAnimating:] () #13 0x000000018cb16d70 in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 () #14 0x000000018cb16c10 in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke () #15 0x000000018655ef78 in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ () #16 0x00000001866b4a24 in -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] () #17 0x000000018cb16a44 in -[UIViewController _setViewAppearState:isAnimating:] () #18 0x000000018cb1753c in -[UIViewController __viewDidDisappear:] () #19 0x000000018cb17638 in -[UIViewController _endAppearanceTransition:] () #20 0x000000018ca2401c in __48-[UIPresentationController transitionDidFinish:]_block_invoke () #21 0x000000018ca23cd0 in -[UIPresentationController transitionDidFinish:] () #22 0x000000018ca2d720 in -[_UICurrentContextPresentationController transitionDidFinish:] () #23 0x000000018ca27608 in __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke.106 () #24 0x000000018cb31fec in -[_UIViewControllerTransitionContext completeTransition:] () #25 0x000000018d7f09bc in -[UITransitionView notifyDidCompleteTransition:] () #26 0x000000018d7f0750 in -[UITransitionView _didCompleteTransition:] () #27 0x000000018bf1c2a4 in __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ () #28 0x000000018d817960 in -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] () #29 0x000000018d7f7168 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] () #30 0x000000018d7f75cc in -[UIViewAnimationState animationDidStop:finished:] () #31 0x000000018d7f763c in -[UIViewAnimationState animationDidStop:finished:] () #32 0x0000000186fedda4 in run_animation_callbacks () #33 0x000000010365e2d0 in _dispatch_client_callout () #34 0x000000010367f4c0 in _dispatch_main_queue_drain.cold.5 () #35 0x0000000103654778 in _dispatch_main_queue_drain () #36 0x00000001036546b4 in _dispatch_main_queue_callback_4CF () #37 0x00000001865b42c8 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ () #38 0x0000000186567b3c in __CFRunLoopRun () #39 0x0000000186566a6c in _CFRunLoopRunSpecificWithOptions () #40 0x0000000226ee5498 in GSEventRunModal () #41 0x000000018bf2aba4 in -[UIApplication _run] () #42 0x000000018bed3a78 in UIApplicationMain ()
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
248
1w
iOS 26: hidesSharedBackground does not work for backBarButtonItem
What works let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) backButton.hidesSharedBackground = true self.navigationItem.rightBarButtonItem = backButton // or self.navigationItem.leftBarButtonItem = backButton What doesn't work let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) backButton.hidesSharedBackground = true self.navigationItem.backBarButtonItem = backButton I've tried setting this property on all possible permutations and combinations e.g. Inside navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) and pushViewController(_ viewController: UIViewController, animated: Bool) of a custom UINavigationController to make sure. Expected vs Actual behavior Setting hidesSharedBackground = true should remove the glass background from both regular bar button items and back bar button items but it has no effect on backBarButtonItem. Additional context I’m aware of the UIDesignRequiresCompatibility Info.plist key, but I’m looking for a programmatic solution if there is one. The goal is to remove the glass background from back buttons.
1
1
194
1w
iOS 26 UIGlassEffect on custom UIButton
I have three custom UIButton instances inside a custom UIView subclass (not inside a UINavigationBar, UIToolbar, or UITabBar). I want to apply UIGlassEffect with interactive = YES to each button so they get the native liquid glass press animation. The problem is that the UIVisualEffectView containing the effect either: Has userInteractionEnabled = YES — glass animation works but the button's IBAction never fires Has userInteractionEnabled = NO — IBAction fires but no glass animation How can I have both the native interactive glass animation and the button action firing on the same button? Is this possible with the public API, or is the interactive glass animation on custom buttons simply not supported outside of standard UIKit controls?
1
0
57
1w
Transparency in Sheet differs in SwiftUI and UIKit+UIHostingContrller
My app is a UIKit app with a lot of SwiftUI mixed in. A common scenario is that a UIViewController presents a sheet with a SwiftUI view wrapped in a UIHostingController. When I present the exact same SwiftUI View it looks different in a SwiftUI sheet compared to when it's wrapped in a UIHostingController and presented from a view controller. I'm using a hacky workaround in which I loop through all subviews of the hosting controller in viewWillLayoutSubviews and look for a NavigationStackHostingController<SwiftUI.AnyView> to manually set the background color, but it feels like it could brake easily. Has anyone found a better way to fix this? Feedback: FB22028838
0
1
85
1w
Does Liquid Glass ignore regular hit testing in SwiftUI?
I’ve encountered an aspect of the Liquid Glass effect in SwiftUI that seems a bit odd: the Liquid Glass interaction appears to ignore regular hit-testing behavior. The following sample shows a button with hit testing disabled: @main struct LiquidGlassHitTestDemo: App { var body: some Scene { WindowGroup { Button("Liquid") { fatalError("Never called.") } .buttonStyle(.glassProminent) .allowsHitTesting(false) } } } As expected, the button’s action is never called. However, the interactive glass effect still responds to touch events: What’s even more surprising is that the UIKit equivalent behaves differently: final class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let button = UIButton( configuration: .prominentGlass(), primaryAction: UIAction( title: "Liquid", handler: { action in print("Never called.") } ) ) view.addSubview(button) button.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ button.centerXAnchor.constraint(equalTo: view.centerXAnchor), button.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) button.isUserInteractionEnabled = false } } In this case, the effect is not interactive at all. Similarly, if a UIViewController’s root view overrides hitTest(_:with:) to always return nil, the Liquid Glass effect does not react to touch events whatsoever. The only way I’ve found to “properly” disable the glass interactivity in SwiftUI is to use the .disabled(true) modifier. However, this also changes the button’s appearance, which is not always desirable. Is this expected behavior, or could this be a bug? Am I missing something about how Liquid Glass interaction is implemented in SwiftUI?
0
2
78
2w
When you set inputAccessoryView AND inputView you get unexpected system UI in between the two custom views
When you set inputAccessoryView AND inputView you get unexpected system UI in between the two custom views If anyone has a workaround for this I'd love to hear it. See also: https://stackoverflow.com/questions/79818015/uitextfield-custom-inputaccessoryview-with-custom-inputview-in-ios-26 Red == inputAccessoryView Blue == inputView Glassy bit in between == bug? // // ViewController.swift // Custom Keyboard // // Created by Lewis Smith on 19/02/2026. // import UIKit class ViewController: UIViewController { let textField = { let textField = UITextField() textField.translatesAutoresizingMaskIntoConstraints = false textField.backgroundColor = .yellow let inputAccessoryView = UIView(frame: CGRect(x: 0, y: 0, width: .zero, height: 70)) inputAccessoryView.backgroundColor = .red let inputView = UIView(frame: CGRect(x: 0, y: 0, width: .zero, height: 70)) inputView.backgroundColor = .blue // When you set inputAccessoryView AND inputView you get unexpected UI inbetweeen the two custom views textField.inputAccessoryView = inputAccessoryView textField.inputView = inputView textField.becomeFirstResponder() return textField }() override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = .purple self.view.addSubview(textField) NSLayoutConstraint.activate([ textField.centerXAnchor.constraint(equalTo: view.centerXAnchor), textField.centerYAnchor.constraint(equalTo: view.centerYAnchor), textField.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), textField.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20), ]) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
111
2w
sharedBackgroundVisibility Not Removing Spacing
Any logical reason why applying .sharedBackgroundVisibility(.hidden) to a ToolbarItem would not remove the spacing allocated for glass border? Thus causing any element utilizing this functionality to appear offset from the regular buttons. Or is this yet another magical Apple experience I am not blessed enough to understand.
4
0
154
2w
iOS 26 UISearchController always appears at the bottom instead of top with preferredSearchBarPlacement = .stacked
Hi everyone, I’m running into a strange issue with UISearchController placement with iOS 26 SDK. In one of my view controllers, I was able to move the search bar to the top of the navigation bar by setting: navigationItem.searchController = searchController navigationItem.hidesSearchBarWhenScrolling = false navigationItem.preferredSearchBarPlacement = .stacked This works as expected — the search bar is placed at the top. However, in another view controller with almost identical configuration, the search bar always shows up at the bottom. If I delay the setup with DispatchQueue.main.async, it appears at the bottom; if I don’t, it doesn’t appear at all. Both VCs are wrapped in their own UINavigationController. So my questions are: Has anyone faced this issue where preferredSearchBarPlacement = .stacked is ignored? Are there hidden requirements or limitations for placing the search bar at the top? Why could the same setup behave differently in two controllers? Any help or ideas would be appreciated!
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
354
2w
EXC_BAD_ACCESS issue need advice
Could you help me with resolving this issue, please. I've got following trace: ksmemory_notifyUnhandledFatalSignal EXC_BAD_ACCESS (KERN_INVALID_ADDRESS) Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000000002b Crashed: com.apple.main-thread 0 KSCrash 0xbff8 ksmemory_notifyUnhandledFatalSignal + 12 1 KSCrash 0xcd6c handleSignal + 100 2 libsystem_platform.dylib 0x4178 _sigtramp + 56 3 libsystem_kernel.dylib 0x42f8 mach_msg2_internal + 76 4 libsystem_kernel.dylib 0x4214 mach_msg_overwrite + 428 5 libsystem_kernel.dylib 0x405c mach_msg + 24 6 CoreFoundation 0x46868 __CFRunLoopServiceMachPort + 160 7 CoreFoundation 0x1d848 __CFRunLoopRun + 1188 8 CoreFoundation 0x1ca6c _CFRunLoopRunSpecificWithOptions + 532 9 GraphicsServices 0x1498 GSEventRunModal + 120 10 UIKitCore 0x9ddf8 -[UIApplication _run] + 792 11 UIKitCore 0x46e54 UIApplicationMain + 336 12 UIKitCore 0x172938 -[UIScrollView contentInset] + 588 13 AppName 0xed9440 main + 4386804800 (AppDelegate.swift:4386804800) 14 ??? 0x189f76e28 (Missing) It appears that a variable or object is attempting to access another object that has already been deallocated. Based on the stack trace, the issue was likely detected while layout was in progress. Our analytics show this happens generally on app launch and occasionally during normal use. Unfortunately, I couldn't gather additional diagnostic data. I tried to reproduce the issue using the Leaks tool and enabled runtime diagnostics (Address Sanitizer, Malloc Scribble, Zombies), but without success. I may be overlooking something — any suggestions would be greatly appreciated. Thank you in advance
3
0
156
2w
Scene-based Launch Detection
Our app supports UIScene. As a result, launchOptions in application(_:didFinishLaunchingWithOptions:) is always nil. However, the documentation mentions that UIApplication.LaunchOptionsKey.location should be present when the app is launched due to a location event. Given that our app is scene-based: How can we reliably determine whether the app was launched due to a location update, geofence, or significant location change? Is there a recommended pattern or API to detect this scenario in a Scene-based app lifecycle? This information is critical for us to correctly initialize location-related logic on launch. Relevant documentation: https://developer.apple.com/documentation/corelocation/cllocationmanager/startmonitoringsignificantlocationchanges()
2
0
245
2w
Custom collection view layout animation jumps
I have a very simple custom collection view layout that supports self-sizing. When a cell is selected, I expand the cell by modifying its constraints. This change (and the resulting effect on the collection view layout) is animated using [self.collectionView.collectionViewLayout invalidateLayout] followed by [self.collectionView layoutIfNeeded] within an animation closure. When you first tap on a cell, it expands smoothly as expected. When you tap on it again to contract it, however, its content jumps before it shrinks again. How can I fix this? For what it’s worth, I’ve noticed that neither UICollectionViewFlowLayout nor UICollectionViewCompositionalLayout have this issue, which suggests I’m doing self-sizing incorrectly. Here’s a screen recording demonstrating the issue. I’ve also put together a minimal sample project. I’m using Xcode 26.2 and iOS 26.2.1.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
65
2w