In my UITableViewController when a sticky section header is replaced by the following header in succession, the cell below is revealed for a short time. This looks like a glitch to me. Is there a workaround to solve this?
The issue is best explained in video: https://youtube.com/shorts/JIEbFTTIDjA?feature=share
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Posts under UIKit tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello!
I was doing some accessibility testing for my app and found out that when the user switches the text size, all of the data in the text fields is reset, which causes major disruption.
I've tried looking for documentation, but all I've found is information on how to dynamically scale the UI for different text sizes, which I've already implemented.
My guess is that every time Dynamic Type registers a change, it redraws my UI instead of just updating it.
How can I make sure the data is not reset when the text size changes?
We're seeing sporadic crashes on devices running iOS 18.1 - both beta and release builds (22B83). The stack trace is always identical, a snippet of it below. As you can tell from the trace, it's happening in places we embed SwiftUI into UIKit via UIHostingController.
Anyone else seeing this?
4 libobjc.A.dylib 0xbe2c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 30
5 libobjc.A.dylib 0xb040 weak_register_no_lock + 396
6 libobjc.A.dylib 0xac50 objc_storeWeak + 472
7 libswiftCore.dylib 0x43ac34 swift_unknownObjectWeakAssign + 24
8 SwiftUI 0xeb74c8 _UIHostingView.base.getter + 160
9 SwiftUI 0x92124 _UIHostingView.layoutSubviews() + 112
10 SwiftUI 0x47860 @objc _UIHostingView.layoutSubviews() + 36
crash stack:
Crashed: com.apple.main-thread
0 libsystem_pthread.dylib 0x90c thread_chkstk_darwin + 60
1 libsystem_pthread.dylib 0x90c ___chkstk_darwin + 60
2 CoreAutoLayout 0x14c4 -[NSISEngine _flushPendingRemovals] + 56
3 CoreAutoLayout 0x2de08 -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:].cold.1 + 64
4 CoreAutoLayout 0x15d78 -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:] + 204
5 CoreAutoLayout 0x2ce38 -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 108
6 CoreAutoLayout 0x15f1c -[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 100
7 CoreAutoLayout 0x2fdbc -[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 252
8 CoreAutoLayout 0x3020c -[NSLayoutConstraint _setSymbolicConstant:constant:symbolicConstantMultiplier:] + 452
9 CoreAutoLayout 0x30378 -[NSLayoutConstraint setConstant:] + 84
10 UIKitCore 0x51c3c __74-[UIView(UIConstraintBasedLayout) _autoresizingConstraints_frameDidChange]_block_invoke + 140
11 UIKitCore 0x1841174 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 112
12 UIKitCore 0x51b28 -[UIView(UIConstraintBasedLayout) _autoresizingConstraints_frameDidChange] + 452
13 UIKitCore 0x2c894 -[UIView _constraints_frameDidChange] + 100
14 UIKitCore 0x18fac08 -[UIView(Geometry) setFrame:] + 576
15 UIKitCore 0x96712c -[UITabBar setFrame:] + 128
16 UIKitCore 0x1666f4 -[_UITabBarControllerVisualStyle updateTabBarLayout] + 360
17 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
18 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
19 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
20 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
21 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
22 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
23 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
24 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
25 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
26 UIKitCore 0x16671c -[_UITabBarControllerVisualStyle updateTabBarLayout] + 400
27 UIKitCore 0x16642c -[UITabBarController _prepareTabBar] + 128
28 UIKitCore 0x166a10 -[UITabBarController _layoutContainerView] + 376
29 UIKitCore 0x1677a8 -[UITabBarController __viewWillLayoutSubviews] + 28
30 UIKitCore 0x147078 -[UILayoutContainerView layoutSubviews] + 176
31 UIKit 0xb14a0 -[UILayoutContainerViewAccessibility layoutSubviews] + 60
for a more detail crash stack, can see attach file:
crash.txt
crash probabilistic happed after app enter background, and our app support landscape, when crash appear, the system method:
/*
This method is called when the view controller's view's size is changed by its parent (i.e. for the root view controller when its window rotates or is resized).
If you override this method, you should either call super to propagate the change to children or manually forward the change to children.
*/
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator API_AVAILABLE(ios(8.0));
is called;
but for a normal not crash case, when enter background and rotate device, the viewWillTransitionToSize method is not called until app enter foreground;
Are there any suggestions that can help solve this problem, thank you.
Looking to see if anyone has experienced this issue, and is aware of any workarounds.
With an app migrating towards SwiftUI Views but still using UIKit for primary navigation, my app makes use of UIHostingController to push SwiftUI Views onto a UINavigationController stack in a lot of areas. With iOS 26, I notice that SwiftUI's Menu view really struggles to present when contained in a UIHostingController. An error is logged to the console on presentation, and depending on the UI, the Menu won't present inside of it's container, or will jump around the screen.
The bug, it seems is based in a private class UIReparentingView and I am curious if anyone has found a work around for this issue. The error reported is:
Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead.
The simplest way to see this issue is to create a new storyboard based project. From the ViewController present a UIHostingController with a SwiftUI view that has a Menu and then simply tap to open the Menu. Thanks for any input!
Hi,
I have an app that displays tens of short (<1mb) mp4 videos stored in a remote server in a vertical UICollectionView that has horizontally scrollable sections.
I'm caching all mp4 files on disk after downloading, and I also have a in-memory cache that holds a limited number (around 30) of players. The players I'm using are simple views that wrap an AVPlayerLayer and its AVPlayerItem, along with a few additional UI components.
The scrolling performance was good before iOS 26, but with the release of iOS 26, I noticed that there is significant stuttering during scrolling while creating players with a fileUrl. It happens even if use the same video file cached on disk for each cell for testing.
I also started getting this kind of log messages after the players are deinitialized:
<<<< PlayerRemoteXPC >>>> signalled err=-12785 at <>:1107
<<<< PlayerRemoteXPC >>>> signalled err=-12785 at <>:1095
<<<< PlayerRemoteXPC >>>> signalled err=-12785 at <>:1095
There's also another log message that I see occasionally, but I don't know what triggers it.
<< FigXPC >> signalled err=-16152 at <>:1683
Is there anyone else that experienced this kind of problem with the latest release?
Also, I'm wondering what's the best way to resolve the issue. I could increase the size of the memory cache to something large like 100, but I'm not sure if it is an acceptable solution because:
1- There will be 100 player instance in memory at all times.
2- There will still be stuttering during the initial loading of the videos from the web.
Any help is appreciated!
We have submitted a feedback for this issue: FB21230723
We're building a note-taking app for iOS and macOS that uses both UITextView and NSTextView.
When performing text input that involves a marked range (such as Japanese input) in a UITextView or NSTextView with a UITextViewDelegate or NSTextViewDelegate set, the text view's marked range (markedTextRange / markedRange()) has not yet been updated at the moment when shouldChangeTextIn is invoked.
UITextViewDelegate.textView(_:shouldChangeTextIn:replacementText:)
NSTextViewDelegate.textView(_:shouldChangeTextIn:replacementString:)
The current behavior is this when entering text in Japanese: (same for NSTextView)
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
print(textView.markedTextRange != nil) // prints out false
DispatchQueue.main.async {
print(textView.markedTextRange != nil) // prints out true
}
}
However, we need the value of markedTextRange right away in order to determine whether to return true or false from this method.
Is there any workaround for this issue?
After the iOS 26 update, unwanted animations appear on UIButton.
I'm using the attributedTitle property of UIButton.Configuration to change the button's text, and an animation appears after iOS 26.
(It's unclear whether it's after iOS 26.0 or iOS 26.1, but it likely started with 26.1.)
The peculiar thing is that the animation only starts appearing on buttons that have been pressed once.
I tried using UIView.performWithoutAnimation and CATransaction's begin(), setDisableActions(true), commit(), but it didn't work.
How should I solve this?
Below is the code for changing the button's text.
func updateTitle() {
let keys = type.keys
if keys.count == 1 {
guard let key = keys.first else { return }
if key.count == 1 {
if Character(key).isLowercase {
self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 24, weight: .regular), .foregroundColor: UIColor.label]))
} else if Character(key).isUppercase {
self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
} else {
self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
}
} else {
self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 18, weight: .regular), .foregroundColor: UIColor.label]))
}
} else {
let joined = keys.joined(separator: "")
self.configuration?.attributedTitle = AttributedString(joined, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label]))
}
}
Why is the UIKeyboard implementation still holding a reference to this UITextField, thus keeping it from being deallocated?
The memory debugger shows:
UIKeyboardImpl -> UIKBAutofillController -> NSMutableDictionary -> NSMutable...(Storage) -> UITextField
Any idea what's going on there?
My app doesn't respond on iPhone Air iOS 26.1.
After startup, my app shows the main view with a tab bar controller containing 4 navigation controllers. However, when a second-level view controller is pushed onto any navigation controller, the UI freezes and becomes unresponsive. The iPhone simulator running iOS 26.1 exhibits the same problem.
The debug profile shows CPU usage at 100%.
However, other devices and simulators do not have this problem.
UIViewController's modalInPopover is deprecated and might disappear in the near future. Is there any replacement?
UIViewController's presentViewController:animated:completion is not an equivalent because the modal style cannot be changed while the controller is already presented.
Dear random Apple UIKit engineer. This is a question for you. Today let's speak about keyboard notifications. In particular, UIResponder.keyboardWillShowNotification and UIResponder.keyboardWillHideNotification.
While working with those, I noticed some undocumented behaviour.
First, let me give you some context:
extension UIViewController {
func registerForKeyboardNotifications() {
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification), name: UIResponder.keyboardWillHideNotification, object: nil)
}
/// Override this method to handle keyboard notifications.
@objc func keyboardNotification(_ notification: Notification) { ... }
}
Eventually, I found that latter method with 3 dots has an implicit animation inside it's scope. Here is the [proof.](https://medium.com /uptech-team/why-does-uiresponder-keyboard-notification-handler-animate-10cc96bce372)
Another thing I noticed, is that this property definition is perfectly valid let curve = UIView.AnimationCurve(rawValue: 7)!. The 7 btw comes from UIResponder.keyboardAnimationCurveUserInfoKey as a default value during my tests. So, the enum with 4 possible values (0...3) can be initialized with a value out of enum's cases range. Also, how can I initialize UIView.AnimationOption from 7? I will pollute my OptionSet which I feed to options parameter on UIView.animate(...)
My questions:
Why implicit animation is not documented and can I trust it or it's a subject to change.
Why UIView.AnimationCurve(rawValue: 7)! does not crash.
How can I convert UIResponder.keyboardAnimationCurveUserInfoKey's value into UIView.AnimationOption properly if I don't want to use implicit value.
I don't encroach on UIKit secrets. I just need to know how to work with the API.
Thank you!
I want to support Genmoji input in my SwiftUI TextField or TextEditor, but looking around, it seems there's no SwiftUI only way to do it?
If none, it's kind of disappointing that they're saying SwiftUI is the path forward, but not updating it with support for new technologies.
Going back, does this mean we can only support Genmoji through UITextField and UIViewRepresentable? or there more direct options?
Btw, I'm also using SwiftData for storage.
Hello! What UIKit API enables you to add a view below the navigation bar and extend the scroll edge effect below it in iOS 26? safeAreaBar is how you do it in SwiftUI but I need to achieve this design in my UIKit app (which has a collection view in a view controller in a navigation controller).
struct ContentView: View {
let segments = ["First", "Second", "Third"]
@State private var selectedSegment = "First"
var body: some View {
NavigationStack {
List(0..<50, id: \.self) { i in
Text("Row \(i + 1)")
}
.safeAreaBar(edge: .top) {
Picker("Segment", selection: $selectedSegment) {
ForEach(segments, id: \.self) {
Text($0)
}
}
.pickerStyle(.segmented)
.padding(.horizontal)
.padding(.bottom, 8)
}
.navigationTitle("Title")
.navigationBarTitleDisplayMode(.inline)
}
}
}
Hello. I have an 12 year old app that still has some objective-c code in it. I have a place where i have a flip animation between 2 view controllers that looks like this:
[UIView transitionFromView:origView
toView:newViewController.view
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromRight
completion:nil];
It has looked like this since 2012 at least.
In our production release, it works prior to 26.1, but in 26.1 and 26.2, the flip is off-center and looks weird. it's like both edges flip the same way. It's a little bit hard to explain.
If seen at least 2 other app store apps that i have installed behave this way too, from 26.1 and onwards.
Anyone else seen this? Is there anything that can be done about it?
Thankful for thoughts.
I have an app where I create UIToolbars and add them to UIViews programatically. I've never used autolayout for anything, I've never assigned any constraints to anything, etc.
This worked fine pre-iOS 26.
Now I'm trying to build for iOS 26 (liquid glass) and my toolbars are spamming my debug pane with hundreds of lines of autolayout warnings. Here are some key phrases from the warnings:
Unable to simultaneously satisfy constraints.
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
Does anybody know what happened and how I can get it to stop? The way things are, I can't use the debug pane for anything because of this spam.
When a UIVisualEffect with glass effect view is added with opacity 0, it remains hidden as expected. But when changing it back to 1 should make it visible, but currently it stays hidden forever. The bug is only reproducible on iOS 26.1 and iOS 26.2. It does not happen on iOS 26.0. The issue is also not reproducible with UIBlurEffect. Only happens for Glass effect
Here is the repro link
Hello!
I'm creating a settings page for my app and I want it to look as native as possible. I want to know if it's possible to add constraints that make the second label go to the bottom when the text size gets really large (see Picture1) instead of having to force it to be on the right (see Picture 2).
I've left my constraint code for this cell down below, too.
I'm still learning constraints and best practices, so if there's any feedback, I'd love to hear it. Thank you!
Picture 1
Picture 2
- (void) setConstraints {
[NSLayoutConstraint activateConstraints:@[
// Cell Title Label
[self.themeColorLabel.leadingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.leadingAnchor],
[self.themeColorLabel.trailingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.trailingAnchor],
[self.themeColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor],
[self.themeColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor],
// Selected Theme Color Label
[self.selectedColorLabel.trailingAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.trailingAnchor],
[self.selectedColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor],
[self.selectedColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor],
]];
}
After switching our iOS app project from Swift 5 to Swift 6 and publishing an update, we started seeing a large number of crashes in Firebase Crashlytics.
The crashes are triggered by NotificationCenter methods (post, addObserver, removeObserver) and show the following error:
BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread (0x1f9dc1580)]
All scopes to related calls are already explicitly marked with @MainActor. This issue never occurred with Swift 5, but appeared immediately after moving to Swift 6.
Has anyone else encountered this problem? Is there a known solution or workaround?
Thanks in advance!
I was trying to figure out why my bottom sheet looks weird and doesn't have the "proper glass" look. I found that this issue seems to be new to iOS 26.1.
See the images below, they show the same view hierarchy (in this case UIHostingController configured as bottom sheet that has NavigationStack and content.
On iOS 26.1 there seems to be extra two layers of background - even though I am no adding any.
iOS 26:
iOS 26.1
Has anyone experienced something similar? Any workarounds? I am happy to completely disable the glass effect for this bottom sheet if it helps.
The screenshots show one sheet, but the same thing happens for another ones.