I am implementing an AI chat application and aiming to achieve ChatGPT-like behavior. Specifically, when a new message is sent, the ScrollView should automatically scroll to the top to display the latest message.
I am currently using the scrollTo method for this purpose, but the behavior is inconsistent—sometimes it works as expected, and other times it does not. I’ve noticed that this issue has been reported in multiple places, which suggests it may be a known SwiftUI limitation.
I’d like to know:
Has this issue been fixed in recent SwiftUI versions, or does it still persist?
If it still exists, is there a reliable solution or workaround that anyone can recommend?
Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
iOS 26 SwiftUI .glassEffect() renders dark/gray on physical device - TestFlight doesn't fix it
.glassEffect() renders as dark/muddy gray on my physical iPhone instead of the light frosted glass like Apple Music's tab bar.
What I've confirmed:
Same code works perfectly on iOS Simulator
Apple Music and other Apple apps show correct Liquid Glass on same device
Brand new Xcode project with just .glassEffect() also renders dark
TestFlight build (App Store signing) has the SAME problem - still dark/gray
This rules out developer signing vs App Store signing as the cause
What I've tried:
Clean build, delete derived data, reinstall app
Completely reinstalled Xcode
All accessibility settings correct (Reduce Transparency OFF, Liquid Glass set to Clear)
Disabled Metal diagnostics
Debug and Release builds
Added window configuration for Extended sRGB/P3 color space
Added AppDelegate with configureWindowForLiquidGlass()
Tried .preferredColorScheme(nil)
Tried background animation to force "live" rendering
Environment:
iPhone 17 Pro, iOS 26.3
Xcode 26.2
macOS 26.3
The question:
Why does .glassEffect() work for Apple's apps but not third party apps, even with App Store signing via TestFlight? What am I missing?
OS 26.s, Xcode 26.2
TLDR: My pure SwiftUI app freezes the window server, is this a known problem?
My app is pure SwiftUI, no low level calls, no networking, no tricksy pointer use. Somehow, something in my code is terminally confusing the Window Server. As in, I run the app, and before I ever seen a window, the Window Server locks up, and is killed by the OS for being unresponsive.
Using debugging shows that I get to the end of a Canvas, and it simply freezes upon exiting.
I'm about to do the old comment out everything, and bring it back a bit at a time, but I'm wondering if anyone is experiencing this sort of thing? The reaction is so extreme.
And it's not Xcode in particular, I built the program with xcodebuild, Xcode itself not running, and ran my app, and it did the same thing.
Topic:
UI Frameworks
SubTopic:
SwiftUI
I had take screenshots by following code
let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
let window = windowScene?.windows.first
self.uiImage = window?.rootViewController?.view!.getImage(rect: rect)
View has two views. One is ImageView contains some image and overlay of image detection results with .overlay. another view is InfoView contains several info and button which above code fired. on iOS 17, I can take screenshots as I saw, but on iOS26, missing on image of ImageView. Overlay(detected rectangle) in Imageview and InfView can be taken.
How can I take screenshots as I saw on iOS26?(iPad)
I have an Apple TV photo slideshow app (Objective-C, Storyboard based, transitioned to scenes and UIKit from old Appdelegate model) which is trivial but exhibits a problem I can't fix. The app has 2 UIImageViews, pulls photos from iCloud, replaces the back view, fades between them, swaps front and back images. I cannot for the life of me work out how to tell tvOS / UIKit that I need to stay in the foreground. Other slideshow apps manage it, clearly movie viewing apps like Netflix, Disney+ and BBC iPlayer manage to stay on top without the user needing to interact with the UI, but I keep getting pushed out. The pushing out happens only if I am playing music on the Apple TV, either using the built-in music app or AirPlaying music to the Apple TV from an iPad or phone.
The issue is reproducible in an app that does nothing except load up a photo from the main bundle into a UIImageView. It's as if the OS thinks I'm idle and I need to nudge it to remind it I'm still here, but I can find no hints in Apple's documentation as to how I should do this.
Project of trivial app here : https://drive.google.com/file/d/1eY_nQJ7adHEgAvFwhS-t38dqBEPVovub/view?usp=sharing
Topic:
UI Frameworks
SubTopic:
UIKit
Hey there guys, I'm new on SwiftUI and iOS Development world.
How can I achieve a seamless TabBar transition in SwiftUI? Currently, when I programmatically hide the TabBar on a pushed view and swipe back to the previous view, there is a noticeable delay before the TabBar reappears. How can I make it appear instantly?
Here is the link to the video https://streamable.com/3zz2o2
Thank you in advance
Topic:
UI Frameworks
SubTopic:
SwiftUI
Our project include UIKIt and SwiftUI, and in some case, we need to traverse all subviews, for UIKit implement views, below code:
func findView(byIdentifier identifier: String) -> UIView? {
if self.accessibilityIdentifier == identifier {
return self
}
for subview in subviews {
if let found = subview.findView(byIdentifier: identifier) {
return found
}
}
return nil
}
works well, but for SwiftUI implement views, like below code:
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
.accessibilityIdentifier("Image")
Text("Hello, world!")
.accessibilityIdentifier("Text")
}
.padding()
}
}
it can not find subviews in the ContentView, and only a view with type:
_UIHostingView<ModifiedContent<AnyView, RootModifier>>
can be found, the Image and Text is not found;
And because we have set a accessibilityIdentifier property, so we also try use:
@MainActor
var accessibilityElements: [Any]? { get set }
to find sub node, but this accessibilityElements is not stable, we can find the Image and Text node in iOS26.1 system:
[AX] level=3 AccessibilityNode @ 0x000000010280fb10 id=Image
[AX] level=3 AccessibilityNode @ 0x000000010161fbf0 id=Text
but can not find it in iOS26.0 and below system.
Any suggestion in how to find SwiftUI subviews? thank you
Topic:
UI Frameworks
SubTopic:
SwiftUI
I have a MacOS app which displays PDFs, and I want to create a New document from the Clipboard, if the clipboard contains valid graphical data.
My problem is that even if it doesn't, I still get a blank new document window. AppKit always creates a new document.
I've tried overriding the newDocument function; I've tried avoiding the built-in functions altogether.
Are there any general recommendations for going about this?
I have a custom UI to display date (for user birthday) and want if the user presses each part of the label , the date selection is displayed, the current issue is , when I try to reduce the DatePicker opacity or set the colorMultipli to clear color, it still clickable on the date area, while my object is a fullWidth object, how can I fix it?
This is the code:
VStack(alignment: .leading, spacing: 8) {
Text("Birthday")
.font(.SFProText.font(type: .medium, size: 13))
.foregroundStyle(Color(uiColor: .label))
HStack(alignment: .center) {
Text(userProfileAccountInfoviewModel.birthday.getShortFormat(format: "dd MMM yyyy"))
.font(.SFProText.font(type: .medium, size: 13))
.foregroundColor(Color(uiColor: .label))
.padding(.horizontal, 13)
Spacer()
}
.frame(height: 44)
.contentShape(Rectangle())
.overlay {
HStack {
DatePicker(selection: $userProfileAccountInfoviewModel.birthday, displayedComponents: .date) {}
.labelsHidden()
.colorMultiply(.clear)
.background(Color.clear)
.foregroundStyle(Color.baseBackgroundSecondary)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
// .opacity(0.011)
Spacer()
}
}
.background(Color.baseBackgroundSecondary)
.clipShape(RoundedRectangle(cornerRadius: 4))
}
Hey all,
I found a weird behaviour with the searchable component. I created a custom bottom nav bar (because I have custom design in my app) to switch between screens.
On one screen I display a List component with the searchable component. Whenever I enter the search screen the first time, the searchable component is displayed at the bottom.
This is wrong. It should be displayed at the top under the navigationTitle. When I enter the screen a second time, everything is correct.
This behaviour can be reproduced on all iOS 26 versions on the simulator and on a physical device with debug and release build.
On iOS 18 everything works fine.
Steps to reproduce:
Cold start of the app
Click on Search TabBarIcon (searchable wrong location)
Click on Home TabBarIcon
Click on Search TabBarIcon (searchable correct location)
Simple code example:
import SwiftUI
struct ContentView: View {
@State var selectedTab: Page = Page.main
var body: some View {
NavigationStack {
ZStack {
VStack {
switch selectedTab {
case .main:
MainView()
case .search:
SearchView()
}
}
VStack {
Spacer()
VStack(spacing: 0) {
HStack(spacing: 0) {
TabBarIcon(iconName: "house", selected: selectedTab == .main, displayName: "Home")
.onTapGesture {
selectedTab = .main
}
TabBarIcon(iconName: "magnifyingglass", selected: selectedTab == .search, displayName: "Search")
.onTapGesture {
selectedTab = .search
}
}
.frame(maxWidth: .infinity)
.frame(height: 55)
.background(Color.gray)
}
.ignoresSafeArea(.all, edges: .bottom)
}
}
}
}
}
struct TabBarIcon: View {
let iconName: String
let selected: Bool
let displayName: String
var body: some View {
ZStack {
VStack {
Image(systemName: iconName)
.resizable()
.renderingMode(.template)
.aspectRatio(contentMode: .fit)
.foregroundColor(Color.black)
.frame(width: 22, height: 22)
Text(displayName)
.font(Font.system(size: 10))
}
}
.frame(maxWidth: .infinity)
}
}
enum Page {
case main
case search
}
struct MainView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
.navigationTitle("Home")
}
}
struct SearchView: View {
@State private var searchText = ""
let items = [
"Apple",
"Banana",
"Pear",
"Strawberry",
"Orange",
"Peach",
"Grape",
"Mango"
]
var filteredItems: [String] {
if searchText.isEmpty {
return items
} else {
return items.filter {
$0.localizedCaseInsensitiveContains(searchText)
}
}
}
var body: some View {
List(filteredItems, id: \.self) { item in
Text(item)
}
.navigationTitle("Fruits")
.searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always), prompt: "Search")
}
}
hello im using the new IOS 26 api for passkey creation ASAuthorizationAccountCreationProvider
however it only seems to work with apple's Passwords app. Selecting 3rd party password apps (1Password, google chrome, etc) does not create the passkey.
The sign up sheet gives me the option to save in 3rd party apps, but when I select a 3rd party app, I just get the ASAuthorizationError cancelled error? So I dont even know what the problem is?
When selecting "Save in Passwords(apple's app)" during the sign up it works fine
Has anyone else run into this issue? Is there something I need to do enable 3rd party apps?
Description
I am seeing inconsistent clipping behavior in UICollectionViewCell when presenting a context menu by long press on a subview that uses UIGlassEffect.
Summary of behavior:
Long-pressing a normal view inside a UICollectionViewCell presents the menu correctly (no clipping).
Long-pressing a view wrapped in UIVisualEffectView using UIGlassEffect causes the sub-view with glass effect to be clipped at the cell’s bounds.
clipsToBounds = false is set on:
the cell
the cell’s contentView
This behavior is reproducible and appears to be specifically related to UIGlassEffect.
Description
I'm developing a custom keyboard extension using UIInputViewController and need to set a specific height of 268 points. The keyboard functions correctly, but there's a visible flicker and resize animation during launch that I cannot eliminate.
The Problem
When the keyboard launches, iOS provides incorrect heights before settling on the correct one. At launch, the view starts at 0×0. Around 295ms later, iOS sets the frame to 440×956 which is full screen height and wrong. Around 373ms, iOS changes it to 440×452 which is still wrong. Finally around 390ms, iOS settles at 440×268 which matches our constraint.
This causes visible flicker as the view resizes three times rapidly. The keyboard appears to shrink from full screen down to the correct height, and users can clearly see this animation happening.
What I've Tried
I've tried adding a height constraint on self.view which gives me the correct height but causes the visible flicker.
I created a custom UIInputView subclass and overrode intrinsicContentSize to return my desired height. iOS completely ignores this and gives random heights like 471pt, 680pt, or 956pt instead.
I set allowsSelfSizing to true on my UIInputView subclass. iOS ignores this property.
I set preferredContentSize on the view controller. iOS ignores this as well.
I tried adding the constraint in viewDidAppear instead of viewDidLoad, thinking iOS might have settled by then. It still causes flicker.
I overrode the frame and bounds setters on my UIInputView to clamp the height to my desired value. iOS bypasses these overrides somehow.
I overrode layoutSubviews to force the correct height after the super call. iOS still applies its own height.
Specific Question
What is the correct API or technique to specify a keyboard extension's height that iOS will respect immediately upon launch, without triggering the resize animation sequence?
Other third-party keyboards like Grammarly and SwiftKey appear to have solved this problem. Their keyboards appear at the correct height without any visible flicker. How do they achieve this?
Expected Outcome
The keyboard should appear at 268pt height on the first frame with no visible resize animation.
Steps to Reproduce
Create a new iOS App project in Xcode and add a Keyboard Extension target. In KeyboardViewController.swift, add a height constraint in viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
let heightConstraint = view.heightAnchor.constraint(equalToConstant: 268)
heightConstraint.priority = .defaultHigh
heightConstraint.isActive = true
let label = UILabel()
label.text = "Demo Keyboard"
label.textAlignment = .center
label.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(label)
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
Build and run on a physical device. Enable the keyboard in Settings, then General, then Keyboard, then Keyboards. Open any app with a text field and switch to the custom keyboard using the globe button. Observe the height changing from around 956pt to 452pt to 268pt with visible animation.
Environment
iOS 17 and iOS 18 and 26.2, Xcode 16 and Xcode 26, affects all iPhone models tested, reproducible on both simulator and physical device.
My app developed with the new Xcode 26 doesn't appear on CarPlay when running on iOS 14–15 devices. My developer has obtained the com.apple.developer.carplay-driving-task permission, but iOS 16+ devices allow my app to display on CarPlay.
Can anyone help resolve this issue? Is it because the carplay-driving-task permission is only available for iOS 16+ devices? If I want compatibility with iOS 14–15 devices, do I need to apply to Apple for the carplay-audio permission to use it? Has anyone encountered a similar issue?
Thanks!
We have a native iOS app built with UIKit, and we are experiencing issues with credit card autofill when using the keyboard Quick Type bar. We have reviewed the documentation on Associated Domains, but we haven’t found anything that specifically addresses our issue. Our goal is to autofill all credit card details-including the CVV-in a single step, rather than one field at a time
I remember this integration being demoed at WWDC25.
Ability to trigger app intent for iOS application from Spotlight search on MacOS.
How Do I extend my iOS Application to be able to do this?
Where is the documentation for implementing this mechanism?
Thank you in advance for your help. I believe this integration is a powerful productivity unlock!
How can I scroll to TextEditor cursor position in SwiftUI
Topic:
UI Frameworks
SubTopic:
SwiftUI
When I appendAttributedString to [textView textStorage] it does not appear on the scrollable TextView.
However when I NSLog the [textView textStorage] the Attributed string is outputted, and is therefore stored in the textView, see below.
Occurs every time I ask to see the AttributedString I send to the textView.
[textView textStorage] attributedString
I need to see the attributedString displayed on the ScrollableTextView, but I don't know why I cannot see it.
Hello,
I am trying to use matchedGeometryEffect to animate between an item in a list view and the item's detail view. Right now, I am getting an unwanted cross-fade animation as the view transitions. So the list item moves into place as it should with the modifier, but it fades out as its detail version fades in, which I do not want. I do not want any fading at all, just the movement from one component to the other.
How do I stop this?
Thanks.
In SwiftUI, iOS 18+ provides a dedicated Search tab role:
Tab(value: .search, role: .search) {
Text("This view is intentionally blank")
}
This displays Search as a separate tab bar item/slot.
Is there an official UIKit equivalent for UITabBarController / UITabBarItem?
If not, what is Apple’s recommended UIKit approach to achieve the same UX?
Topic:
UI Frameworks
SubTopic:
UIKit