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.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

Layout issue using .strokeBorder modifier
Hello, Developers! While writing custom view modifier I ran into unexpected behavior of .strokeBorder modifier. The underlying content seem to be “bleeding” outside of the stroke border edges, even though they share the exact same shape for their layout. This issue relevant for both Xcode Previews and on-device testing. Maybe someone has experienced this issue before, I'd be glad to see your opinion on this matter.
1
0
109
1w
Animation does not work with List, while works with ScrollView + ForEach
Why there is a working animation with ScrollView + ForEach of items removal, but there is none with List? ScrollView + ForEach: struct ContentView: View { @State var items: [String] = Array(1...5).map(\.description) var body: some View { ScrollView(.vertical) { ForEach(items, id: \.self) { item in Text(String(item)) .frame(maxWidth: .infinity, minHeight: 50) .background(.gray) .onTapGesture { withAnimation(.linear(duration: 0.1)) { items = items.filter { $0 != item } } } } } } } List: struct ContentView: View { @State var items: [String] = Array(1...5).map(\.description) var body: some View { List(items, id: \.self) { item in Text(String(item)) .frame(maxWidth: .infinity, minHeight: 50) .background(.gray) .onTapGesture { withAnimation(.linear(duration: 0.1)) { items = items.filter { $0 != item } } } } } }```
6
1
195
1w
screenshot on iOS26
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)
10
0
602
1w
App Launchscreen Size NOT Correct on iPadOS 26
Hello, We’re seeing an iPad-specific Launch Screen issue related to multitasking window sizes. Environment Device: iPad (iPadOS 26) Device orientation: Landscape App is launched in a small window where the app window is portrait-shaped (width < height) Issue When the iPad is in landscape but the app is launched as a portrait-shaped small window, the LaunchScreen.storyboard appears to be rendered/layouted as landscape, not matching the actual window geometry. As a result, the Launch Screen content is clipped / partially missing (we see blank/empty area at the bottom during launch). After the app finishes launching, our first view controller uses the correct window size and the UI looks fine — the problem is mainly during the Launch Screen phase. What we checked LaunchScreen.storyboard uses Auto Layout and is expected to adapt to screen/window size. This only reproduces when the device orientation and the app window aspect ratio don’t match (landscape device + portrait-shaped app window, or vice versa). When device orientation and window shape are aligned, the Launch Screen displays correctly. Question Is it expected that iPadOS renders LaunchScreen.storyboard based on the interface orientation / size class rather than the actual window bounds in multitasking scenarios? If not expected, what is the recommended way to ensure the Launch Screen matches the app’s actual window size/aspect ratio at launch (without using code, since Launch Screen is static)? Are there any additional diagnostics or recommended steps to help us investigate and confirm the root cause (e.g., specific logs, APIs/values to capture at launch such as UIWindowScene bounds, interfaceOrientation, size classes, or any guidance on how Launch Screen snapshots are chosen/cached in multitasking)? Thank you.
0
0
77
1w
iOS 26 & Xcode 26 - bug with keyboard by WebView
Environment iOS 26 (23A343) Xcode 26 Reproduces on device and Simulator Description When presenting a SwiftUI WebView (native iOS 26 component) or a WKWebView/UIWebView via UIViewRepresentable, focusing a text field inside the web view and then dismissing it breaks the keyboard layout behavior. After returning to the main app, tapping any TextField causes the keyboard to cover bottom controls (e.g. buttons). Expected safe area insets are not applied. The issue is only resolved after closing and reopening the keyboard once. Steps to Reproduce Open a SwiftUI screen with WebView (via .sheet or NavigationLink). Inside the web view, tap a text field to show the keyboard. Dismiss the web view. Tap a TextField in the main app. Expected Result Layout should adjust correctly. Bottom controls stay visible above the keyboard. Actual Result Keyboard covers bottom controls. Insets are ignored until the keyboard is dismissed and reopened. Notes Reproduces with: Native SwiftUI WebView (iOS 26) WKWebView and UIWebView via UIViewRepresentable Presentation style (.sheet or navigation push) does not matter. Example video: https://youtu.be/Epgoz1vETKU FB: FB20386257 Sample Code import SwiftUI import WebKit struct ContentView: View { @State var url: URL? @FocusState private var isFocused: Bool var body: some View { VStack { TextField("TextField", text: .constant("")) .focused($isFocused) Button("HIDE KEYBOARD") { isFocused = false } Spacer() Button("ACTION") { url = URL(string: "https://google.com") } } .sheet(item: $url) { value in NavigationStack { WebView(url: value) .toolbar { ToolbarItem(placement: .topBarLeading) { Button("CLOSE") { url = nil } } } } } } } extension URL: Identifiable { public var id: String { absoluteString } }
2
5
1.1k
1w
OS 26 Liquid Glass: UITabBar overrides selected title text color after trait changes, causing icon and title color mismatch
I’m seeing unexpected UITabBar behavior on iOS 26 when Liquid Glass is enabled. I’m using UITabBarAppearance with a dynamic UIColor to keep the selected tab bar icon and title text in sync (blue in light mode, green in dark mode). Expected behavior The selected tab bar icon and title text should always resolve to the same color based on the current trait collection. Actual behavior On initial load, the colors are correct. However, after switching light/dark mode (or any trait change that triggers a material update): The icon keeps the configured color The title text color is overridden by the system Result: selected icon and title text end up with different colors This happens even though both colors are explicitly set to the same dynamic UIColor. Minimal reproducible example: func applyAppearance() { let color = UIColor { trait in trait.userInterfaceStyle == .dark ? .green : .blue } self.tabBar.tintColor = color }
Topic: UI Frameworks SubTopic: UIKit
1
0
110
1w
Animation Glitch behind Tab-bar
I'm trying to replicate edit/select mode of iOS 26 photos app. When user clicks Select button, bottom tab bar is replaced by the toolbar buttons. When I press Done button, a white opaque bar appears at the bottom behind the tabbar. It looks pretty straightforward to implement but I'm banging my head here now. Any help will be appreciated. Code and animation frames attached bellow struct ContentView: View { var body: some View { TabView(selection: $selectedTab) { OverviewView() .tabItem { Image(systemName: "chart.pie") Text("Overview") } .tag(0) //rest of the tabs } } } struct OverviewView: View { @State private var editActive = false @State private var selection = Set<String>() @State private var items = [ "Item 1", "Item 2", "Item 3", ] var body: some View { NavigationStack { List(selection: $selection) { ForEach(items, id: \.self) { item in Text(item) } } .toolbar { if editActive { ToolbarItem(placement: .bottomBar) { Button { } label: { Label("Delete", systemImage: "trash") } } ToolbarItem(placement: .bottomBar) { Button { } label: { Label("Category", systemImage: "tag") } } } ToolbarItem(placement: .topBarTrailing) { Button(editActive ? "Done" : "Select") { withAnimation { editActive.toggle() } } } } .environment(\.editMode, .constant(editActive ? .active : .inactive)) .toolbar(editActive ? .hidden : .visible, for: .tabBar) } } } I have attached 5 frames during animation phase.
1
0
109
1w
.glassEffect() renders dark on device but works on simulator - TestFlight doesn't fix it
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?
5
0
290
1w
Slow rendering List backed by SwiftData @Query
Hello, I've a question about performance when trying to render lots of items coming from SwiftData via a @Query on a SwiftUI List. Here's my setup: // Item.swift: @Model final class Item: Identifiable { var timestamp: Date var isOptionA: Bool init() { self.timestamp = Date() self.isOptionA = Bool.random() } } // Menu.swift enum Menu: String, CaseIterable, Hashable, Identifiable { var id: String { rawValue } case optionA case optionB case all var predicate: Predicate<Item> { switch self { case .optionA: return #Predicate { $0.isOptionA } case .optionB: return #Predicate { !$0.isOptionA } case .all: return #Predicate { _ in true } } } } // SlowData.swift @main struct SlowDataApp: App { var sharedModelContainer: ModelContainer = { let schema = Schema([Item.self]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) return try! ModelContainer(for: schema, configurations: [modelConfiguration]) }() var body: some Scene { WindowGroup { ContentView() } .modelContainer(sharedModelContainer) } } // ContentView.swift struct ContentView: View { @Environment(\.modelContext) private var modelContext @State var selection: Menu? = .optionA var body: some View { NavigationSplitView { List(Menu.allCases, selection: $selection) { menu in Text(menu.rawValue).tag(menu) } } detail: { DemoListView(selectedMenu: $selection) }.onAppear { // Do this just once // (0..<15_000).forEach { index in // let item = Item() // modelContext.insert(item) // } } } } // DemoListView.swift struct DemoListView: View { @Binding var selectedMenu: Menu? @Query private var items: [Item] init(selectedMenu: Binding<Menu?>) { self._selectedMenu = selectedMenu self._items = Query(filter: selectedMenu.wrappedValue?.predicate, sort: \.timestamp) } var body: some View { // Option 1: touching `items` = slow! List(items) { item in Text(item.timestamp.description) } // Option 2: Not touching `items` = fast! // List { // Text("Not accessing `items` here") // } .navigationTitle(selectedMenu?.rawValue ?? "N/A") } } When I use Option 1 on DemoListView, there's a noticeable delay on the navigation. If I use Option 2, there's none. This happens both on Debug builds and Release builds, just FYI because on Xcode 16 Debug builds seem to be slower than expected: https://indieweb.social/@curtclifton/113273571392595819 I've profiled it and the SwiftData fetches seem blazing fast, the Hang occurs when accessing the items property from the List. Is there anything I'm overlooking or it's just as fast as it can be right now?
10
4
1.7k
1w
Crash in swift::_getWitnessTable when passing UITraitBridgedEnvironmentKey
When using UITraitBridgedEnvironmentKey to pass a trait value to the swift environment, it causes a crash when trying to access the value from the environment. The issue seems to be related to how swift uses the UITraitBridgedEnvironmentKey protocol since the crash occurs in swift::_getWitnessTable () from lazy protocol witness table accessor…. It can occur when calling any function that is generic using the UITraitBridgedEnvironmentKey type. I originally encountered the issue when trying to use a UITraitBridgedEnvironmentKey in SwiftUI, but have been able to reproduce the issue with any function with a similar signature. https://developer.apple.com/documentation/swiftui/environmentvalues/subscript(_:)-9zku Steps to Reproduce Requirements for the issue to occur Project with a minimum iOS version of iOS 16 Build the project with Xcode 26 Run on iOS 18 Add the following code to a project and call foo(key: MyCustomTraitKey.self) from anywhere. @available(iOS 17.0, *) func foo<K>(key: K.Type) where K: UITraitBridgedEnvironmentKey { // Crashes before this is called } @available(iOS 17.0, *) public enum MyCustomTraitKey: UITraitBridgedEnvironmentKey { public static let defaultValue: Bool = false public static func read(from traitCollection: UITraitCollection) -> Bool { false } public static func write(to mutableTraits: inout UIMutableTraits, value: Bool) {} } // The crash will occur when calling this. It can be added to a project anywhere // The sample project calls it from scene(_:willConnectTo:options:) foo(key: MyCustomTraitKey.self) For example, I added it to the SceneDelegate in a UIKit Project class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if #available(iOS 17, *) { // The following line of code can be placed anywhere in a project, `SceneDelegate` is just a convenient place to put it to reproduce the issue. foo(key: MyCustomTraitKey.self) // ^ CRASH: Thread 1: EXC_BAD_ACCESS (code=1, address=0x10) } } } Actual Behaviour The app crashes with the stack trace showing the place calling foo but before foo is actually called. (ie, a breakpoint or print in foo is never hit) #0 0x000000019595fbc4 in swift::_getWitnessTable () #1 0x0000000104954128 in lazy protocol witness table accessor for type MyCustomTraitKey and conformance MyCustomTraitKey () #2 0x0000000104953bc4 in SceneDelegate.scene(_:willConnectTo:options:) at .../SceneDelegate.swift:20 The app does not crash when run on iOS 17, or 26 or when the minimum ios version is raised to iOS 17 or higher. It also doesn't crash on iOS 16 since it's not calling foo since UITraitBridgedEnvironmentKey was added in iOS 17. Expected behaviour The app should not crash. It should call foo on iOS 17, 18, and 26.
4
1
195
1w
Xcode26 build app with iOS26, UITabBarController set CustomTabBar issue
Our project using UITabBarController and set a custom tabbar using below code: let customTabBar = CustomTabBar(with: dataSource) setValue(customTabBar, forKey: "tabBar") But when using Xcode 26 build app in iOS 26, the tabbar does not show: above code works well in iOS 18: below is the demo code: AppDelegate.swift: import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { let window: UIWindow = UIWindow() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { window.rootViewController = TabBarViewController() window.makeKeyAndVisible() return true } } CustomTabBar.swift: import UIKit class CustomTabBar: UITabBar { class TabBarModel { let title: String let icon: UIImage? init(title: String, icon: UIImage?) { self.title = title self.icon = icon } } class TabBarItemView: UIView { lazy var titleLabel: UILabel = { let titleLabel = UILabel() titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.font = .systemFont(ofSize: 14) titleLabel.textColor = .black titleLabel.textAlignment = .center return titleLabel }() lazy var iconView: UIImageView = { let iconView = UIImageView() iconView.translatesAutoresizingMaskIntoConstraints = false iconView.contentMode = .center return iconView }() private var model: TabBarModel init(model: TabBarModel) { self.model = model super.init(frame: .zero) setupSubViews() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } private func setupSubViews() { addSubview(iconView) iconView.topAnchor.constraint(equalTo: topAnchor).isActive = true iconView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true iconView.widthAnchor.constraint(equalToConstant: 34).isActive = true iconView.heightAnchor.constraint(equalToConstant: 34).isActive = true iconView.image = model.icon addSubview(titleLabel) titleLabel.topAnchor.constraint(equalTo: iconView.bottomAnchor).isActive = true titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true titleLabel.heightAnchor.constraint(equalToConstant: 16).isActive = true titleLabel.text = model.title } } private var dataSource: [TabBarModel] init(with dataSource: [TabBarModel]) { self.dataSource = dataSource super.init(frame: .zero) setupTabBars() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func sizeThatFits(_ size: CGSize) -> CGSize { var sizeThatFits = super.sizeThatFits(size) let safeAreaBottomHeight: CGFloat = safeAreaInsets.bottom sizeThatFits.height = 52 + safeAreaBottomHeight return sizeThatFits } private func setupTabBars() { backgroundColor = .orange let multiplier = 1.0 / Double(dataSource.count) var lastItemView: TabBarItemView? for model in dataSource { let tabBarItemView = TabBarItemView(model: model) addSubview(tabBarItemView) tabBarItemView.translatesAutoresizingMaskIntoConstraints = false tabBarItemView.topAnchor.constraint(equalTo: topAnchor).isActive = true tabBarItemView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true if let lastItemView = lastItemView { tabBarItemView.leadingAnchor.constraint(equalTo: lastItemView.trailingAnchor).isActive = true } else { tabBarItemView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true } tabBarItemView.widthAnchor.constraint(equalTo: widthAnchor, multiplier: multiplier).isActive = true lastItemView = tabBarItemView } } } TabBarViewController.swift: import UIKit class NavigationController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() } } class HomeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .red navigationItem.title = "Home" } } class PhoneViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .purple navigationItem.title = "Phone" } } class PhotoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .yellow navigationItem.title = "Photo" } } class SettingViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .green navigationItem.title = "Setting" } } class TabBarViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() let homeVC = HomeViewController() let homeNav = NavigationController(rootViewController: homeVC) let phoneVC = PhoneViewController() let phoneNav = NavigationController(rootViewController: phoneVC) let photoVC = PhotoViewController() let photoNav = NavigationController(rootViewController: photoVC) let settingVC = SettingViewController() let settingNav = NavigationController(rootViewController: settingVC) viewControllers = [homeNav, phoneNav, photoNav, settingNav] let dataSource = [ CustomTabBar.TabBarModel(title: "Home", icon: UIImage(systemName: "house")), CustomTabBar.TabBarModel(title: "Phone", icon: UIImage(systemName: "phone")), CustomTabBar.TabBarModel(title: "Photo", icon: UIImage(systemName: "photo")), CustomTabBar.TabBarModel(title: "Setting", icon: UIImage(systemName: "gear")) ] let customTabBar = CustomTabBar(with: dataSource) setValue(customTabBar, forKey: "tabBar") } } And I have post a feedback in Feedback Assistant(id: FB18141909), the demo project code can be found there. How are we going to solve this problem? Thank you.
Topic: UI Frameworks SubTopic: UIKit Tags:
5
0
729
1w
.safeAreaBar(edge: .bottom), animation lag on appear/disappear
When I try to show/hide the content in .safeAreaBar(edge: .bottom), especially the content with a large height, the background animation of the toolbar is very laggy. iOS 26 RC Feedback ID - FB19768797 import SwiftUI struct ContentView: View { @State private var isShown: Bool = false var body: some View { NavigationStack { Button("Toggle") { withAnimation { isShown.toggle() } } ScrollView(.vertical) { ForEach(0..<100) { index in Text("\(index)") .padding() .border(.blue) .background(.blue) .frame(maxWidth: .infinity) } } .scrollEdgeEffectStyle(.soft, for: .bottom) .safeAreaBar(edge: .bottom) { if isShown { Text("Safe area bar") .padding(64) .background(.red) } } } } } #Preview { ContentView() }
1
3
187
1w
.contactAccessPicker shows blank sheet on iOS 26.2.1 on device
Calling contactAccessPicker results in a blank sheet and a jetsam error, rather than the expected contact picker, using Apple’s sample code, only on device with iOS 26.2.1. This is happening on a iPhone 17 Pro Max running 26.2.1, and not on a simulator. I’m running Apple's sample project Accessing a person’s contact data using Contacts and ContactsUI Steps: Run the sample app on device running iOS 26.2.1. Use the flow to authorize .limited access with 1 contact: Tap request access, Continue, Select Contacts. Select a contact, Continue, Allow Selected Contact. This all works as expected. Tap the add contact button in the toolbar to add a second contact. Expected: This should show the Contact Access Picker UI. Actual: Sheet is shown with no contents. See screenshot of actual results on iOS device running 26.2.1. Reported as FB21812568 I see a similar (same?) error reported for 26.1. It seems strange that the feature is completely broken for multiple point releases. Is anyone else seeing this or are the two of us running into the same rare edge case? Expected Outcome, seen on simulator running 26.2 Actual outcome, seen on device running 26.2.1
3
0
174
1w
ASAuthorizationAccountCreationProvider does not work with 3rd party apps
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?
7
0
428
1w
Issues with ScrollView and nested (Lazy)VStack
Hello, We're having massive issues when we nest LazyVStacks inside a ScrollView. Our app relies heavily on custom views that are sometimes nested two or three levels deep. While the app does work fine overall, we see a massive spike in CPU usage in Instruments when accessibility features like VoiceOver are enabled. Those spikes never recover, so the app basically freezes and stays that way until force quit. We are in talks with a third-party service that uses accessibility features we want to use. Fortunately they have created a GitHub repository which recreates the issue we're facing. It would be greatly appreciated if someone could have a look at the code and tell us what the issue is, or if there's some kind of workaround. Here's the link to the repo: https://github.com/pendo-io/SwiftUI_Hang_Reproduction. Just to be clear, the issue is not directly related to the third-party SDK, but to the accessibility features used in conjunction with SwiftUI. As you can see in the repo the issue is reproducible without having the SDK included in the project. Thanks in advance
1
0
133
1w
WKWebView + Bluetooth Keyboard: Ctrl+Home / Ctrl+End causes app crash after input blur (iPadOS 18.4.1 / 18.6.2)
1. Summary In a hybrid iOS app using WKWebView (Angular + Capacitor), after programmatically blurring an element and connecting a Bluetooth keyboard, pressing Ctrl+Home or Ctrl+End causes the app to crash. The crash stack shows the issue occurs inside UIKit keyboard handling (UITextInteractionSelectableInputDelegate _moveToStartOfLine), indicating a system-level bug. 2. Steps to Reproduce Open the hybrid app containing a WKWebView. Blur the input (programmatically). Connect a Bluetooth keyboard. Press Ctrl + Home or Ctrl + End. Expected result: No crash. The command should be ignored if no text input is active. Actual result: App crashes immediately. 3. Crash Log (Crashlytics Trace) Crashed: com.apple.main-thread 0 WebKit 0xfbdad0 <redacted> + 236 1 UIKitCore 0x10b0548 -[UITextInteractionSelectableInputDelegate _moveToStartOfLine:withHistory:] + 96 2 UIKitCore 0xd0fb38 -[UIKBInputDelegateManager _moveToStartOfLine:withHistory:] + 188 3 UIKitCore 0xa16174 __158-[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:]_block_invoke + 52 4 UIKitCore 0xa36ae4 -[_UIKeyboardStateManager performBlockWithTextInputChangesIgnoredForNonMacOS:] + 48 5 UIKitCore 0xa160f0 -[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:] + 440 6 UIKitCore 0xa06614 -[_UIKeyboardStateManager handleKeyCommand:repeatOkay:options:] + 3204 7 UIKitCore 0xa2fb64 -[_UIKeyboardStateManager _handleKeyCommandCommon:options:] + 76 8 UIKitCore 0xa2fb08 -[_UIKeyboardStateManager _handleKeyCommand:] + 20 9 UIKitCore 0xa30684 -[_UIKeyboardStateManager handleKeyEvent:executionContext:] + 2464 10 UIKitCore 0xa2f95c __42-[_UIKeyboardStateManager handleKeyEvent:]_block_invoke + 40 11 UIKitCore 0x4b9460 -[UIKeyboardTaskEntry execute:] + 208 12 UIKitCore 0x4b92f4 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 356 13 UIKitCore 0x4b8be0 -[UIKeyboardTaskQueue addTask:breadcrumb:] + 120 14 UIKitCore 0xa2f8d0 -[_UIKeyboardStateManager handleKeyEvent:] + 432 15 CoreFoundation 0x2f934 __invoking___ + 148 16 CoreFoundation 0x2efac -[NSInvocation invoke] + 424 17 UIKitCore 0x14cbcc4 -[UIRepeatedAction invoke] + 176 18 UIKitCore 0x14cbeb8 -[UIRepeatedAction _preInvocationTimerFire] + 56 19 UIKitCore 0x1195364 -[UIApplication _handleKeyboardPressEvent:] + 2192 20 UIKitCore 0x1187278 -[UIApplication pressesBegan:withEvent:] + 328 21 UIKitCore 0x9b808 forwardTouchMethod + 376 22 UIKitCore 0x9b808 forwardTouchMethod + 376 23 UIKitCore 0x9b808 forwardTouchMethod + 376 24 UIKitCore 0x9b808 forwardTouchMethod + 376 25 UIKitCore 0x9b808 forwardTouchMethod + 376 26 UIKitCore 0x9b808 forwardTouchMethod + 376 27 UIKitCore 0x9b808 forwardTouchMethod + 376 28 UIKitCore 0x9b808 forwardTouchMethod + 376 29 WebKit 0x66e2b4 <redacted> + 84 30 UIKitCore 0x9b808 forwardTouchMethod + 376 31 UIKitCore 0x157290c -[UIScrollView pressesBegan:withEvent:] + 148 32 UIKitCore 0x9b808 forwardTouchMethod + 376 33 WebKit 0xfbbd04 <redacted> + 100 34 UIKitCore 0x11a7620 -[UIWindow _sendButtonsForEvent:] + 312 35 UIKitCore 0x522dc -[UIWindow sendEvent:] + 568 36 UIKitCore 0x5f508 -[UIApplication sendEvent:] + 376 37 UIKitCore 0x1194364 -[UIApplication _handleKeyUIEvent:] + 136 38 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 39 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 40 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 41 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 42 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 43 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 44 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 45 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 46 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 47 UIKitCore 0x11a3e14 -[UIResponder _handleKeyUIEvent:] + 56 48 UIKitCore 0x11943e8 -[UIApplication handleKeyUIEvent:] + 56 49 UIKitCore 0x11942ac -[UIApplication _handleKeyHIDEvent:usingSyntheticEvent:] + 660 50 UIKitCore 0x117ac __dispatchPreprocessedEventFromEventQueue + 4648 51 UIKitCore 0xfbe4 __processEventQueue + 4812 52 UIKitCore 0x94e4 updateCycleEntry + 160 53 UIKitCore 0x9404 _UIUpdateSequenceRun + 84 54 UIKitCore 0x8ab4 schedulerStepScheduledMainSection + 208 55 UIKitCore 0x41e4 runloopSourceCallback + 92 56 CoreFoundation 0xf92c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 57 CoreFoundation 0xf744 __CFRunLoopDoSource0 + 172 58 CoreFoundation 0xf5a0 __CFRunLoopDoSources0 + 232 59 CoreFoundation 0xff20 __CFRunLoopRun + 840 60 CoreFoundation 0x11adc CFRunLoopRunSpecific + 572 61 GraphicsServices 0x1454 GSEventRunModal + 168 62 UIKitCore 0x135274 -[UIApplication _run] + 816 63 UIKitCore 0x100a28 UIApplicationMain + 336 64 Order 0xa2ed0 main + 21 (AppDelegate.swift:21) 4. Environment iPadOS versions: 18.1.0, 18.4.1, 18.6.2 WebView: WKWebView Hybrid stack: Angular + (Capacitor) Reproducible on multiple iPads and multiple iPadOS 18.x versions. 5. Expected Behavior Pressing Ctrl+Home or Ctrl+End when no text input is active should be ignored and should not crash the app.
1
0
134
1w
SwiftUI ScrollView scrollTo not consistently scrolling to latest message
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?
3
0
187
1w
WidgetKit + AppIntent widget never sees shared snapshots (Flutter host app)
Environment iOS 17.2, Xcode 16.2, physical iPhone (12 Pro) Main app in Flutter WidgetKit extension written in Swift (Swift‑PM package) Shared App Group: group.cool.glance.shared Widget uses an AppIntent (FeedSelectionIntent) + custom entity (FeedAppEntity) Flutter bridge writes JSON snapshots for the widget Observed behaviour Flutter prints the snapshot payload and writes /…/AppGroup/<uuid>/Library/Caches/feed_snapshots.json. Widget gallery only shows the plain grey system placeholder (my sample placeholder never appears). Console log every time WidgetKit runs: chronod: Unable to resolve default intent (appintent:FeedSelectionIntent) for extension cool.glance.app.widget Error Domain=LNMetadataProviderErrorDomain Code=9000 LinkMetadata.BundleMetadataExtractionError.aggregateMetadataIsEmpty Added os_log in the widget + bridge (WidgetsBridgePlugin, FeedSnapshotStore, FeedEntityQuery, FeedSummaryTimeline), but none of them ever appear. That suggests the widget bundle can’t see the compiled AppIntent metadata or the snapshot file even though it’s there. Code (trimmed to essentials) FeedSelectionIntent.swift struct FeedSelectionIntent: AppIntent, WidgetConfigurationIntent { static var title: LocalizedStringResource = "Feed" static var description = IntentDescription("Choose which feed should appear in the widget.") @Parameter(title: "Feed", requestValueDialog: IntentDialog("Select which feed to display.")) var feed: FeedAppEntity? static var parameterSummary: some ParameterSummary { Summary("Show \(\.$feed)") } init() { feed = FeedAppEntity.sample } init(feed: FeedAppEntity?) { self.feed = feed } static var defaultValue: FeedSelectionIntent { FeedSelectionIntent(feed: .sample) } func perform() async throws -> some IntentResult { .result() } } FeedSnapshotStore.loadSnapshots() guard let containerURL = fileManager.containerURL( forSecurityApplicationGroupIdentifier: appGroupIdentifier) else { os_log("FeedSnapshotStore: missing app group container %{public}s", log: Self.log, type: .error, appGroupIdentifier) return [] } let fileURL = SharedConstants.feedSnapshotRelativePath.reduce(containerURL) { url, component in url.appendingPathComponent(component, isDirectory: component != SharedConstants.feedSnapshotFileName) } guard let data = try? Data(contentsOf: fileURL), !data.isEmpty else { os_log("FeedSnapshotStore: no snapshot data found at %{public}s", log: Self.log, type: .info, fileURL.path) return [] } // decode FeedSnapshotEnvelope… WidgetsBridgePlugin.writeSnapshots (Flutter → widget) guard let containerURL = fileManager.containerURL( forSecurityApplicationGroupIdentifier: SharedConstants.appGroupIdentifier) else { result(FlutterError(code: "container-unavailable", message: "Unable to locate shared app group container.", details: nil)) return } let targetDir = SharedConstants.feedSnapshotRelativePath.dropLast().reduce(containerURL) { $0.appendingPathComponent($1, isDirectory: true) } try fileManager.createDirectory(at: targetDir, withIntermediateDirectories: true) let targetURL = targetDir.appendingPathComponent(SharedConstants.feedSnapshotFileName, isDirectory: false) try data.write(to: targetURL, options: .atomic) WidgetCenter.shared.reloadTimelines(ofKind: "GlanceSummaryWidget") os_log("WidgetsBridgePlugin: wrote snapshots for %{public}d feeds at %{public}s", log: WidgetsBridgePlugin.log, type: .info, envelope.feeds.count, targetURL.path) Info.plist for the widget contains only: <key>NSExtensionPointIdentifier</key> <string>com.apple.widgetkit-extension</string> <key>NSExtensionAttributes</key> <dict> <key>WKAppBundleIdentifier</key> <string>cool.glance.app</string> </dict> (If I add NSExtensionPrincipalClass, the install fails with “principal class not allowed for com.apple.widgetkit-extension”, so it stays out.) What I’ve double‑checked App Group entitlement present on Runner.app and the widget extension. Snapshot file definitely exists under Library/Caches/feed_snapshots.json (size updates when Flutter writes). Code matches Apple’s “Making a configurable widget” sample (custom WidgetConfigurationIntent, entity, and timeline provider). Cleaned build folders (Flutter + Xcode), reinstalled app from scratch, but I still don’t see any of the os_log messages from the widget extension-only the LinkMetadata error above. Placeholder entry (SampleSnapshots.recentSummary) is wired up; yet the system never uses it and always drops to the generic grey preview. Questions Does LinkMetadata.BundleMetadataExtractionError.aggregateMetadataIsEmpty mean WidgetKit can’t see the compiled AppIntent metadata? If so, what could cause that when the extension is built via Swift Package Manager inside a Flutter project? Are there extra build settings or plist keys required so the AppIntent metadata gets embedded in the widget bundle? Any reason the widget would never reach my FeedSnapshotStore logs even though the file is written and the App Group is configured? Any help connecting the dots would be hugely appreciated.
0
0
228
2w
In SwiftUI on macOS, using instancing in RealityKit, how can I set individual colours per instance?
I have written this function: @available(macOS 26.0, *) func instancing() async -> Entity { let entity = Entity() do { // 1. Create a CustomMaterial let library = offscreenRenderer.pointRenderer!.device.makeDefaultLibrary()! let surfaceShader = CustomMaterial.SurfaceShader( named: "surfaceShaderWithCustomUniforms", // This must match the function name in Metal in: library ) let instanceCount = 10 // No idea how to actually use this... // let bufferSize = instanceCount * MemoryLayout<UInt32>.stride // // // Create the descriptor // var descriptor = LowLevelBuffer.Descriptor(capacity: bufferSize, sizeMultiple: MemoryLayout<UInt32>.stride) // // // Initialize the buffer // let lowLevelBuffer = try LowLevelBuffer(descriptor: descriptor) // lowLevelBuffer.withUnsafeMutableBytes { rawBytes in // // Bind the raw memory to the UInt32 type // let pointer = rawBytes.bindMemory(to: UInt32.self) // pointer[1] = 0xff_0000 // pointer[0] = 0x00_ff00 // pointer[2] = 0x00_00ff // pointer[3] = 0xff_ff00 // pointer[4] = 0xff_00ff // pointer[5] = 0x00_ffff // pointer[6] = 0xff_ffff // pointer[7] = 0x7f_0000 // pointer[8] = 0x00_7f00 // pointer[9] = 0x00_007f // } var material = try CustomMaterial(surfaceShader: surfaceShader, lightingModel: .lit) material.withMutableUniforms(ofType: SurfaceCustomUniforms.self, stage: .surfaceShader) { params, resources in params.argb = 0xff_0000 } // 2. Create the ModelComponent (provides the MESH and MATERIAL) let mesh = MeshResource.generateSphere(radius: 0.5) let modelComponent = ModelComponent(mesh: mesh, materials: [material]) // 3. Create the MeshInstancesComponent (provides the INSTANCE TRANSFORMS) let instanceData = try LowLevelInstanceData(instanceCount: instanceCount) instanceData.withMutableTransforms { transforms in for i in 0..<instanceCount { let instanceAngle = 2 * .pi * Float(i) / Float(instanceCount) let radialTranslation: SIMD3<Float> = [-sin(instanceAngle), cos(instanceAngle), 0] * 4 // Position each sphere around a circle. let transform = Transform( scale: .one, rotation: simd_quatf(angle: instanceAngle, axis: [0, 0, 1]), translation: radialTranslation ) transforms[i] = transform.matrix } } let instancesComponent = try MeshInstancesComponent(mesh: mesh, instances: instanceData) // 4. Attach BOTH to the same entity entity.components.set(modelComponent) entity.components.set(instancesComponent) } catch { print("Failed to create mesh instances: \(error)") } return entity } and this is the corresponding Metal shader typedef struct { uint32_t argb; } SurfaceCustomUniforms; [[stitchable]] void surfaceShaderWithCustomUniforms(realitykit::surface_parameters params, constant SurfaceCustomUniforms &customParams) { half3 color = { static_cast<half>((customParams.argb >> 16) & 0xff), static_cast<half>((customParams.argb >> 8) & 0xff), static_cast<half>(customParams.argb & 0xff) }; params.surface().set_base_color(color); } which works well and generates 10 red spheres. While listening to the WWDC25 presentation on what's new in RealityKit I am positive to hear the presenter saying that it is possible to customise each instance using a LowLevelBuffer, but so far all my attempts have failed. Is it possible, and if so how ? Thanks for reading and for your help. Kind regards, Christian
1
1
229
2w