Hello everyone,
I'm working on an app that uses WKWebView.
My app uses a custom menu and we disable the default menu by overriding with:
WKWebAction.canPerformAction()
However, with the new iOS 18.2 release, I am no longer able to override the "Copy Link with Highlight" option that pops up when highlighting a selection as can be seen from the screenshot:
Has anyone found a work around/bypass for this?
Environment
iOS Version: iOS 18.2
Device: iPhone 13 Pro
App platform: iOS
Xcode version: 16.1
MacOS: 14.5
SwiftUI
RSS for tagProvide views, controls, and layout structures for declaring your app's user interface using SwiftUI.
Posts under SwiftUI tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
My Xcode project fails to run with the following crash log any time I use a new SwiftUI symbol such as ConcentricRectangle or .glassEffect. I've tried using the legacy linker to no avail. It compiles perfectly fine, and I've tried targeting just macOS 26 also to no avail. This is a macOS project that's compiled just fine for years and compiles and runs on macOS going back to 13.0.
Failed to look up symbolic reference at 0x118e743cd - offset 1916987 - symbol symbolic _____y_____y_____y_____yAAyAAy_____y__________G_____G_____yAFGGSg_ACyAAy_____y_____SSG_____y_____SgGG______tGSgACyAAyAAy_____ATG_____G_AVtGSgtGGAQySbGG______Qo_ 7SwiftUI4ViewPAAE11glassEffect_2inQrAA5GlassV_qd__tAA5ShapeRd__lFQO AA15ModifiedContentV AA6VStackV AA05TupleC0V AA01_hC0V AA9RectangleV AA5ColorV AA12_FrameLayoutV AA24_BackgroundStyleModifierV AA6IDViewV 8[ ]012EditorTabBarC0V AA022_EnvironmentKeyWritingS0V A_0W0C AA7DividerV A_0w4JumpyC0V AA08_PaddingP0V AA07DefaultgeH0V in /Users/[ ]/Library/Developer/Xcode/DerivedData/[ ]-grfjhgtlsyiobueapymobkzvfytq/Build/Products/Debug/[ ]/Contents/MacOS/[ ].debug.dylib - pointer at 0x119048408 is likely a reference to a missing weak symbol
Example crashing code:
import SwiftUI
struct MyView: View {
var body: some View {
if #available(macOS 26.0, *) {
Text("what the heck man").glassEffect()
}
}
}
There is no issue with triggering onDrag when long-pressing for the first time. However, if the user releases their finger and the DropDelegate determines this is not a valid drop operation, it will not trigger a view update. In this case, when the user long-presses the same view again, the onDrag method will not be triggered even though the floating Preview view is already displayed under the finger. The problem will not recur if the DropDelegate updates the view (such as swapping the positions of views). The same code works without issues on iOS 18.
The problem can be reproduced with simple code like the following:
struct ContentView: View {
var body: some View {
Rectangle()
.fill(.blue)
.onDrag {
print("OnDrag")
return NSItemProvider()
}
}
}
The "OnDrag" log will only be output once.
The .tint modifier doesn't seem to change the background color on the redesigned macOS 26 toggles.
For example, using:
Toggle("", isOn: isOn)
.toggleStyle(.switch)
.tint(.cyan)
.scaleEffect(0.8)
.opacity(isEnabled ? 1.0 : 0.4)
the toggles use the system accent color instead of cyan.
Has SwiftUI introduced a new modifier for that? I couldn't find anything in the June 2025 changes.
I’m building a document-based macOS app using SwiftUI with an AppKit NSDocument.
By default, when the window has no toolbar, the document title and proxy icon (with the edited state dot and standard saving controls) appear nicely centered in the title bar.
However, as soon as I attach a toolbar - even an empty one - the document proxy moves to the leading edge of the title bar.
Is there a way to keep the document proxy/title centered in a document-based SwiftUI app while also using a toolbar? Or is the left-alignment now the only supported behavior when a toolbar is present?
Thanks in advance for any guidance.
Hey there,
Link to the sample project: https://github.com/dev-loic/AppleSampleScrolling
Context
We are working on creating a feed of posts in SwiftUI. So far, we have successfully implemented a classic feed that opens from the top, with bottom pagination — a standard use case.
Our goal, however, is to allow the feed to open from any post, not just the first one.
For example, we would like to open the feed directly at the 3rd post and then trigger a network call to load elements both above and below it.
Our main focus here is on preserving the scroll position while opening the screen and waiting for the network call to complete.
To illustrate the issue, I created a sample project (attached) with two screens:
MainView, which contains buttons to open the feed in different states.
ScrollingView, which initially shows a single element, simulates a 3-second network call, and then populates with new data depending on which button was tapped.
I am currently using Xcode 26 beta 6, but I can also reproduce this issue on Xcode 16.3.
Tests on sample project
I click on a button and just wait the 3 seconds for the call.
In this scenario, I expect that the “focused item” stays at the exact same place on the screen. I also expect to see items below and above being added.
Simulator iPhone 16 / iOS 18.4 with itemsHeight = 100
position = 0, 1, 2, 3 ⇒ works as expected
position = 4, 5, 6, 7, 8, 9 ⇒ scroll is reset to the top and we loose the focused item
Simulator iPhone 16 / iOS 18.4 with itemsHeight = 500
position = 0, 1, 2, 3, 4 ⇒ works as expected
position = 5, 6, 7 ⇒ I have a glitch (the focused element moves on the screen) but the focused element is still visible
position = 8, 9 ⇒ scroll is reset to the top and we loose the focused item
Simulator iPhone 16 / iOS 26 with itemsHeight = 100 or 500
position = 0, 1, 2, 3, 4 ⇒ works as expected
position = 5, 6, 7, 8, 9 ⇒ I have a glitch (the focused element moves on the screen) but the focused element is still visible
Device iPhone 15 / iOS 26 with itemsHeight = 100
position = 0, 1, 2, 3, 4 ⇒ works as expected
position = 5, 6, 7, 8, 9 ⇒ I have a glitch (the focused element moves on the screen) but the focused element is still visible
Device iPhone 15 / iOS 26 with itemsHeight = 500
position = 0, 1, 2, 3 ⇒ works as expected
position = 4, 5, 6, 7, 8, 9 ⇒ I have a glitch (the focused element moves on the screen) but the focused element is still visible
Not any user interaction
Moreover, in this scenario, the user does not interact with the screen during the simulated network call. Regardless of the situation, if the ScrollView is in motion, its position always resets to the top. This behavior prevents us from implementing automatic pagination when scrolling upward, which is ultimately our goal.
My conclusion so far
As far as I know it seems not possible to have both keeping scroll possible and upward automatic pagination using a SwiftUI LazyVStack inside a ScrollView.
This appears to be standard behavior in messaging apps or other feed-based apps, and I’m wondering if I might be missing something.
Thank you in advance for any guidance you can provide on this topic.
Cheers
When using LazyVGrid within a ScrollView with the .searchable modifier, scrolling is impossible on iPhone 15 (I’m assuming other older devices are affected too). This behavior does not occur on iPhone 16 and newer.
This also only happens, when the search bar is placed at the top, for example if the ScrollView is within a TabView.
Here's a short screen recording of the issue:
And this is a minimal example causing the issue:
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
Tab("Text", systemImage: "gear") {
ExampleTab()
}
}
}
}
struct ExampleTab: View {
@State private var searchText: String = ""
var body: some View {
NavigationStack {
ScrollView {
LazyVGrid(
columns: [GridItem(
.adaptive(minimum: 120)
)],
spacing: 20
) {
ForEach(1..<100) { index in
Text("Test \(index)")
}
}
}
.searchable(text: self.$searchText)
}
}
}
When preparing the app for the new iOS 26, I came across an unpleasant design decision. Specifically, in the new design, the keyboard has rounded corners, under which the system background is visible. And here we have only two options, a light/dark background, which breaks all keyboard calls in the application.
Can you tell me if there is any way around this problem?
Hi, it seems like using Table on iPadOS 26 results in the table header not applying a background. When comparing the same code on iPadOS 18, the table header applies a blur behind the header to ensure legibility when the user scrolls the content.
Is there a way to ensure Table applies a background effect to the header so that content remains legible during scrolling?
Here is a minimal example:
struct TablePreviewContent: Identifiable {
var id: Int { text.hashValue }
var text: String
}
#Preview {
let content = [TablePreviewContent(text: "Hello"), TablePreviewContent(text: "World")]
Table(content) {
TableColumn("Title", value: \.text)
}
}
I've attached screenshots of the behavior on iPadOS 26 compared to iPadOS 18 to illustrate the issue.
Hi everyone,
I’ve encountered an issue where using a popover inside the toolbar of a Catalyst app causes a crash on macOS 26 beta 5 with Xcode 26 beta 5. Here’s a simplified code snippet:
import SwiftUI
struct ContentView: View {
@State private var isPresentingPopover = false
var body: some View {
NavigationStack {
VStack {
}
.padding()
.toolbar {
ToolbarItem {
Button(action: { isPresentingPopover.toggle() }) {
Image(systemName: "bubble")
}
.popover(isPresented: $isPresentingPopover) {
Text("Hello")
.font(.largeTitle)
.padding()
}
}
}
}
}
}
Steps to reproduce:
Create a new iOS app using Xcode 26 beta 5.
Enable Mac Catalyst (Match iPad).
Add the above code to show a Popover from a toolbar button.
Run the app on macOS 26, then click the toolbar button.
The app crashes immediately upon clicking the toolbar button.
Has anyone else run into this? Any workarounds or suggestions would be appreciated!
Thanks!
Hi all,
In my SwiftUI / SwiftData / Cloudkit app which is a series of lists, I have a model object called Project which contains an array of model objects called subprojects:
final class Project1
{
var name: String = ""
@Relationship(deleteRule: .cascade, inverse: \Subproject.project) var subprojects : [Subproject]?
init(name: String)
{
self.name = name
self.subprojects = []
}
}
The user will select a project from a list, which will generate a list of subprojects in another list, and if they select a subproject, it will generate a list categories and if the user selects a category it will generate another list of child objects owned by category and on and on.
This is the pattern in my app, I'm constantly passing arrays of model objects that are the children of other model objects throughout the program, and I need the user to be able to add and remove things from them.
My initial approach was to pass these arrays as bindings so that I'd be able to mutate them. This worked for the most part but there were two problems: it was a lot of custom binding code and when I had to unwrap these bindings using init?(_ base: Binding<Value?>), my program would crash if one of these arrays became nil (it's some weird quirk of that init that I don't understand at al).
As I'm still learning the framework, I had not realized that the @model macro had automatically made my model objects observable, so I decided to remove the bindings and simply pass the arrays by reference, and while it seems these references will carry the most up to date version of the array, you cannot mutate them unless you have access to the parent and mutate it like such:
project.subcategories?.removeAll { $0 == subcategory }
project.subcategories?.append(subcategory)
This is weirding me out because you can't unwrap subcategories before you try to mutate the array, it has to be done like above. In my code, I like to unwrap all optionals at the moment that I need the values stored in them and if not, I like to post an error to the user. Isn't that the point of optionals? So I don't understand why it's like this and ultimately am wondering if I'm using the correct design pattern for what I'm trying to accomplish or if I'm missing something? Any input would be much appreciated!
Also, I do have a small MRE project if the explanation above wasn't clear enough, but I was unable to paste in here (too long), attach the zip or paste a link to Google Drive. Open to sharing it if anyone can tell me the best way to do so. Thanks!
The below code will render a list of items and a button to shuffle them and change their height withAnimation.
If you scroll down and shuffle it you will eventually see glitches in the animation, mostly consisting of ghost items animating on top of other items and disappearing.
Does anyone know why this is happening, and how to stop it happening? The issue goes away entirely if I use a VStack, but using a VStack brings its own problems.
import SwiftUI
struct Item: Identifiable {
let id = UUID()
var height: CGFloat
var label: String
}
struct ContentView: View {
@State private var items: [Item] =
(0..<30).map { i in Item(height: .random(in: 80...220), label: "Row \(i)") }
var body: some View {
NavigationStack {
ScrollView {
LazyVStack(spacing: 8) {
ForEach(items) { item in
Text(item.label)
.frame(maxWidth: .infinity)
.frame(height: item.height)
.background(.gray.opacity(0.15))
.clipShape(RoundedRectangle(cornerRadius: 12))
.padding(.horizontal)
}
}
.padding(.vertical)
}
.navigationTitle("LazyVStack Demo")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button("Shuffle") {
withAnimation() {
items.shuffle()
for i in items.indices {
items[i].height = .random(in: 80...220)
}
}
}
}
}
}
}
}
#Preview { ContentView() }
In SwiftUI on macOS, A menu-style Picker is drawn as a pop-up button.
It generally looks and behaves the same as an NSPopUpButton in AppKit.
SwiftUI introduced iOS-like looking UI for settings in macOS, and consequently, the Picker also has its own style when placed inside a Form.
A Form-style Picker displays only up/down chevrons and draws the background only when the mouse hovers over it. It also changes its width dynamically based on the selected item.
Form {
Picker("Animal:", selection: $selection) {
ForEach(["Dog", "Cow"], id: \.self) {
Text($0)
}
.pickerStyle(.menu)
}
You can find it, for instance, in the Print dialog.
My question is: I couldn't find a way to draw an NSPopUpButton in AppKit with this style. Does anyone know how to achieve this in AppKit?
Some might say I should just use SwiftUI straightforwardly, but I would like to use it in a print panel accessory that currently still avoids using SwiftUI but its dialog has SwiftUI.Form-looking.
Hi everyone,
I’m running into a strange animation glitch when using a Menu inside a glassEffect container.
Here’s a minimal example:
import SwiftUI
struct ContentView: View {
@Namespace private var namespace
var body: some View {
ZStack {
Image(.background)
.resizable()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea()
GlassEffectContainer {
HStack {
Button("b1") {}
Button("b2") {}
Button("b3") {}
Button("b4") {}
Button("b5") {}
Menu {
Button("t1") { }
Button("t2") { }
Button("t3") { }
Button("t4") { }
Button("t5") { }
} label: {
Text("Menu")
}
}
}
.padding(.horizontal)
.frame(height: 50)
.glassEffect()
}
}
}
What happens:
The bar looks fine initially:
When you open the Menu, the entire bar morphs into the menu:
When dismissing, the bar briefly animates into a solid rectangle before reapplying the glass effect:
Questions:
Is there a way to prevent that brief rectangle animation when dismissing the menu?
If not, is it possible to avoid the morphing altogether and have the menu simply overlay on top of the bar instead of replacing it?
Any ideas or workarounds would be greatly appreciated!
I've noticed that the App Store app tends to make the selected tab indicator darker on light mode and lighter on dark mode.
Is there any easy way to ensure better legibility out of the box with Tab View (SwiftUI) when using the tint modifier with custom colors?
I'm currently testing SwiftUI's WebKit by building a browsing application.
For the back navigation, I have the following code implemented:
if let item = webPage.backForwardList.backList.last {
webPage.load(item)
print(
"""
=====
backForwardList.backList:
\(webPage.backForwardList.backList)
---
backForwardList.currentItem:
\(webPage.backForwardList.currentItem)
---
backForwardList.forwardList:
\(webPage.backForwardList.forwardList)
=====
""".trimmingCharacters(in: .whitespacesAndNewlines)
)
}
When I look at the logs, it shows that whenever I navigate back, the currentItem is updated with the item, but the backList is appended with the previous currentItem, and the forwardList is always empty.
Am I implementing this incorrectly?
Thanks in advance!
Hi!
I've encountered strange bug in iOS 26. The MultiDatePicker component exhibits unreliable behavior when attempting to deselect previously chosen dates. Users often need to tap a selected date multiple times (e.g., tap to deselect, tap to re-select, then tap again to deselect) for the UI to correctly register the deselection and update the displayed state.
This issue does not occur on iOS 18 or Xcode 26 previews, where MultiDatePicker functions as expected, allowing single-tap deselection. The bug only occurs on physical device or simulator. I can't lie, I have multidatepicker as crucial component in my larger app and can't really find a solution to this. Has anyone encountered this problem before?
Here is the code to replicate the issue:
import SwiftUI
struct ContentView: View {
@ State private var selectedDates: Set = []
var body: some View {
NavigationStack {
Form {
Section {
MultiDatePicker("Select Dates", selection: $selectedDates)
} header: {
Text("MultiDatePicker Bug Test")
}
Section {
Text("Selected Dates Count: (selectedDates.count)")
ForEach(Array(selectedDates).sorted(by: {
Calendar.current.date(from: $0)! < Calendar.current.date(from: $1)!
}), id: .self) { dateComponent in
if let date = Calendar.current.date(from: dateComponent) {
Text(date.formatted(date: .long, time: .omitted))
}
}
} header: {
Text("Current State of Selected Dates")
}
}
.navigationTitle("Date Picker Bug")
}
}
}
#Preview {
ContentView()
}
Crashlog-0916-071225.log
I have an app that crashes on OSX 26 only. I have a @StateObject which is an observer of the NSColorPanel.
When I call
let panel = NSColorPanel.shared
in init(), SwiftUI will crash - apparently with an update while view is being updated. See crash log.
I was able to work around it by adding
let _ = NSColorPanel.shared
in my AppDelegate before SwiftUI is initialized.
The exact code worked fine in all previous OSX versions.
I have a TabView and in one of the tabs I have a horizontal ScrollView that uses .scrollTargetBehavior(.paging) in each of those pages I have a List, but the bottom of the list around the Tab bar doesnt get blurred, if I remove the horizontal scrollview and just have a list it blurs fine. So I want to know how I can manually add the blur when using the horizontal scrollview
Does anyone know how to add a button to the right side of the bottom tab view for Liquid Glass?