I am adopting some of the new glass UI, but having to duplicate a lot of code to maintain support for previous UI systems in macOS. An example:
if #available(macOS 26.0, *) {
VStack {
/*some 40+ lines of code clipped here for brevity*/
}
.cueButtons()
.cueStyleGlass()
} else {
VStack {
/*identical 40+ lines of code clipped here for brevity*/
}
.cueButtons()
.cueStyle()
}
If I try to use conditional modifiers as indicated here:
extension View {
func cueStyle(font: Font = .system(size: 45)) -> some View {
if #available(macOS 26.0, *) {
modifier(GlassCueStyle(font: font))
} else {
modifier(CueStyle(font: font))
}
}
}
I get this error:
Conflicting arguments to generic parameter 'τ_1_0' ('ModifiedContent<Self, GlassCueStyle>' vs. 'ModifiedContent<Self, CueStyle>')
Is there a better way to do this?
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
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.
I'm struggling to understand whether TextField handles undo by itself, or how to properly handle it myself.
In a macOS app with a SwiftUI lifecycle, in a DocumentGroup scene, I'm using both TextEditors and Textfields. The text editors handle undo out of the box, with undo coalescing.
The text fields seem not to. However, on occasion, they do create undo points, leaving me confused as to what conditions are needed for that to happen.
Is there a way to reliably get text fields to handle undo on their own? Or, how should I implement typing undo, including undo coalescing, manually?
Topic:
UI Frameworks
SubTopic:
SwiftUI
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
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.
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
When using an image in a List item, you sometimes want to tint that image, but only if the item isn’t selected. When it’s selected, you usually want the contents of the list item to be all-white, for contrast.
The backgroundProminence Environment value ostensibly exists for this purpose, but in my tests, it never seems to change. Am I doing something wrong? Is there an alternative solution?
For instance, this code:
import SwiftUI
struct ProminentBackgroundInList: View {
var body: some View {
List(selection: .constant(0)) {
ListItem().tag(0)
ListItem().tag(1)
}
}
}
struct ListItem: View {
@Environment(\.backgroundProminence) var backgroundProminence
var body: some View {
HStack {
Image(systemName: "person.fill")
.foregroundStyle(backgroundProminence == .standard ? .orange : .primary)
Text("Person")
}
}
}
#Preview {
ProminentBackgroundInList()
}
Produces this result:
I'd like to create a Quick Look extension for a file type for which a location or region on a Map should be shown as preview.
However the MapView would only show a grid without any map. From within the MapKit delegate I can see from the "Error" parameter (a server with this domain can not be found) that this seems to be a network issue. The Quick Look extension seems to have no access to the internet and therefore the MapView can not load any map data.
I've then also done some other tests via URLSession, which also only fails with connection errors.
I haven't seen any limitations or restrictions mentioned in the API documentation.
Is this the expected behavior? Is this a bug? Or am I missing something?
I have the following view hierarchy in my app:
[UINavigationController] -> [MainViewController] -> [MyTabBarController] -> [DashboardViewController]
In my MainViewController I have a button that pushes the MyTabBarController onto the navigation controllers stack. In the tab bar controller I only have one tab in this example showing the DashboardViewController.
That all works fine, and when I tap the back button on MyTabBarController, everything works fine and the MainViewController is shown again. The UI works exactly how I want it, but when I load up the 'Debug Memory Graph' view, I can see that my DashboardViewController is still in memory and it seems the UITab has a reference to it. The MyTabBarController is NOT in memory anymore.
MyTabBarController is very simple:
class MyTabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
self.mode = .tabSidebar
var allTabs:[UITab] = []
let mainTab = UITab(title: "Dashboard",
image: UIImage(systemName: "chart.pie"),
identifier: "dashboard",
viewControllerProvider: { _ in
return UINavigationController(rootViewController: DashboardViewController())
})
allTabs.append(mainTab)
setTabs(allTabs, animated: false)
}
}
And the DashboardViewController is empty:
class DashboardViewController: UIViewController {
}
The only reason I created as a seperate class in this example is so I can easily see if it's visible in the memory debug view.
I have uploaded the simple sample app to GitHub:
https://github.com/fwaddle/TabbarMemoryLeakCheck
Anyone have any suggestions?
Here is a screen grab of the memory debug view showing the UITab having a reference to the DashboardViewController even though MyTabBarController has been dealloc'd:
Topic:
UI Frameworks
SubTopic:
UIKit
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.
I’m trying to add a container view above a list view that stretches edge-to-edge across the device.
What’s the recommended approach to achieve this layout with Swift UI?
Example
Topic:
UI Frameworks
SubTopic:
SwiftUI
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.
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
I have an NSWindowController with several IBOutlets created in storyboard.
I want to add an NSView and fill it with some color. I need to place it at a specific position in views hierarchy.
I have tried 2 ways, no one succeeds.
First.
include a custom view in storyboard
connect to an IBOutlet
in an init of controller, set the layer for the view
Result: crash
Second
build programmatically
Result: I do not find where to put this code in the controller code
That's basic Cocoa, but way more painful than iOS.
Memory leak in CarPlay when using CPTabBarTemplate
Reproduced using the code example "Integrating CarPlay with Your Music App" from the official Apple documentation - https://developer.apple.com/documentation/carplay/integrating-carplay-with-your-music-app
Steps to reproduce the leak:
Download and run the example on CarPlay.
Select the Settings tab.
Click the first item in the list "Use Apple Music".
Click Back button.
Repeat steps 3 and 4 several times.
Open Debug Memory Graph in xCode and search for "CPGridTemplate" - the count will be greater than 0.
Conditions under which the memory leak disappears:
If you open and switch to all tabs one by one, the leak disappears.
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
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
Overview
In iOS 26, a List embedded in a NavigationStack inside a TabView exhibits a visual glitch when switching tabs.
When the list is scrolled such that some rows are partially obscured by the navigation bar, the system correctly applies a fade/opacity effect to those rows. However, if the user switches to another tab while rows are in this partially obscured (faded) state, those rows briefly flash at full opacity during the tab transition before disappearing.
This flash is visually distracting and appears to be inconsistent with the intended scroll-edge opacity behavior.
The issue occurs only for rows partially obscured by the navigation bar.
Rows partially obscured by the tab bar do not exhibit this flashing behavior.
Steps to Reproduce:
Run the attached minimal reproduction on iOS 26.
Open the first tab.
Scroll the list so that some rows are partially hidden behind the navigation bar (showing the native faded appearance).
While rows are in this partially faded state, switch to the second tab.
Observe that the faded rows briefly render fully opaque during the tab switch.
Expected Behavior:
Rows that are partially obscured by the navigation bar should maintain consistent opacity behavior during tab transitions, without flashing to full opacity.
import SwiftUI
@main
struct NavBarReproApp: App {
/// Minimal repro for iOS 26:
/// - TabView with two tabs
/// - First tab: NavigationStack + List
/// - Scroll so some rows are partially behind the nav bar (faded)
/// - Switch tabs: those partially-faded rows briefly flash fully opaque. Partially faded rows under the tab bar do not flash
private let items = Array(0..<200).map { "Row \($0)" }
var body: some Scene {
WindowGroup {
TabView {
NavigationStack {
List {
ForEach(items, id: \.self) { item in
Text(item)
}
}
.navigationTitle("One")
.navigationBarTitleDisplayMode(.inline)
}
.tabItem { Label("One", systemImage: "1.circle") }
NavigationStack {
Text("Second tab")
.navigationTitle("Two")
.navigationBarTitleDisplayMode(.inline)
}
.tabItem { Label("Two", systemImage: "2.circle") }
}
}
}
}
If I delete Safari and only have another browser installed on my device, UIApplication.shared.open does not work. I think this is a bug. Why would it not work?
If Safari is not the main browser, UIApplication would open the URL in my main browser.
Those are valid use cases.
I would expect this API to work with any browser...
iOS 26.2
iPhone 14 Pro
guard let url = URL(string: "https://www.apple.com") else {
return
}
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
} else {
print("Could not open URL")
}
Topic:
UI Frameworks
SubTopic:
UIKit
Hi all,
When navigating between two screens where the first uses .inline and the second .large title display mode, the NavigationBar shows visible resizing glitches during the push animation.
This is especially noticeable when using a custom background color (e.g. yellow) via UINavigationBarAppearance or .toolbarBackground(Color.yellow, for: .navigationBar).
I’m already using the same appearance for standard, scrollEdge, and compact, with configureWithOpaqueBackground(), but the issue remains.
Is this a known UIKit or SwiftUI issue?
Any recommended workaround?
Thanks.
Topic:
UI Frameworks
SubTopic:
SwiftUI