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.
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
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?
We’ve encountered an issue while developing with SwiftUI: when using the inspector on iPadOS, if the inspector is placed inside a NavigationStack, and both the view attached to the inspector and the content inside the inspector itself are scrollable, scrolling them to the top may cause abnormal jitter.
We suspect this issue might be related to NavigationTitle. However, if we place the inspector outside the NavigationStack, tapping any NavigationLink while the inspector is expanded will cause problems with the View.matchedTransitionSource(id:in:) animation.
A reproducible project can be found here:
https://github.com/ThreeManager785/Inspetor-Issue
We’ve tried many approaches but haven’t been able to resolve it. Is there any way to fix this issue?
After updating to iPad OS 26, when moving around the app, I can not see the back button, title, and the right menu button on the navigation bar unless I scroll down, then everything is fine.
Any advice ?
Thanks
I have two views I've applied Liquid Glass to in Swift UI. I've noticed that depending on the height of the view the material changes and I'm not sure why. See the attached screenshot. Both views add the liquidGlass style in the same way but behave very differently on the same background.
Ideally I'd like them to look the same as the bottom one. Is that the same as the clear style?
[Also submitted as FB20262774. Posting here in hopes of saving someone else from burning half a day chasing this down.]
Dynamic scaling of an Image() in a Button(), incorrectly decreases when transitioning from XXX Large to AX 1 accessibility text sizes, instead of continuing to grow as expected. This occurs both on device and in the simulator, in iOS 18.6 and iOS 26.
Repro Steps
Create a project with sample code below
Show the preview if not showing
In Xcode Preview, click Canvas Device Settings and change Dynamic Type from XXX Large to AX 1
Sample Code
struct ContentView: View {
var body: some View {
VStack(spacing: 30) {
Text("Button Image Scaling Issue")
.font(.system(size: 24, weight: .semibold))
Text("Switch dynamic type from **XXX Large** to **AX 1**. The **Button** icon shrinks while the **No Button** icon grows.")
.font(.system(size: 14, weight: .regular))
TestView(title: "No Button", isButton: false)
TestView(title: "Button", isButton: true)
}
.padding()
}
}
struct TestView: View {
let title: String
let isButton: Bool
var body: some View {
VStack {
Text(title)
.font(.system(size: 16))
.foregroundColor(.secondary)
if isButton {
Button {} label: {
Image(systemName: "divide")
.font(.system(.largeTitle))
}
.buttonStyle(.bordered)
.frame(height: 50)
} else {
Image(systemName: "divide")
.font(.system(.largeTitle))
.foregroundColor(.blue)
.frame(height: 50)
.background(Color.gray.opacity(0.2))
}
}
}
}
Expected Result
Both the button and non-button images should continue to scale up proportionally when moving to larger accessibility text sizes.
Actual Result
When going from XXX Large to AX 1…
Non-button image gets larger ✅
Button image gets smaller ❌
Screen Recording
System Info
Xcode Version 26.0 (17A321)
iOS 26.0 and 18.6
Hi everyone,
I’ve run into a strange localization issue with macOS document-based apps in SwiftUI/AppKit. I created a standard document-based macOS app in Xcode (SwiftUI template) and added a French localization to the project.
All system-generated menu bar commands (File → New, Close, Print, etc.) are correctly translated into French… except for “Save”, which remains in English.
To rule out problems in my own code, I created a fresh, unmodified document-based app project in Xcode, and immediately added French localization without touching any code. Same result: all commands are translated except “Save”.
This suggests the issue isn’t specific to my app code, but either the project template, or possibly macOS itself.
My environment
• Xcode version: 16.4
• macOS version: 15.6.1 Sequoia]
• Swift: Swift 6
Questions
1. Has anyone else seen this issue with the “Save” command not being localized?
2. Is this expected behavior (maybe “Save” is handled differently from other menu items)?
3. If it’s a bug in the template or OS, is there a known workaround?
Thanks for any insights
P.S. Please note that I'm a total beginner
When displaying a view with a Button inside a ScrollView using the sheet modifier, if you try to close the sheet by swiping and your finger is touching the Button, the touch is not canceled.
This issue occurs when building with Xcode 16 but does not occur when building with Xcode 15.
Here is screen cast.
https://drive.google.com/file/d/1GaOjggWxvjDY38My4JEl-URyik928iBT/view?usp=sharing
Code
struct ContentView: View {
@State var isModalPresented: Bool = false
var body: some View {
ScrollView {
Button {
debugPrint("Hello")
isModalPresented.toggle()
} label: {
Text("Hello")
.frame(height: 44)
}
Button {
debugPrint("World")
} label: {
Text("World")
.frame(height: 44)
}
Text("Hoge")
.frame(height: 44)
.contentShape(Rectangle())
.onTapGesture {
debugPrint("Hoge")
}
}
.sheet(isPresented: $isModalPresented) {
ContentView()
}
}
}
I’m stuck with repeated production crashes in my SwiftUI app and I can’t make sense of the traces on my own.
The symbolicated reports show the same pattern:
Crash on com.apple.CFNetwork.LoaderQ with EXC_BAD_ACCESS / PAC failure
Always deep in CFNetwork, most often in
URLConnectionLoader::loadWithWhatToDo(NSURLRequest*, _CFCachedURLResponse const*, long, URLConnectionLoader::WhatToDo)
No frames from my code, no sign of AuthManager or tokens.
What I’ve tried:
Enabled Address Sanitizer,
Malloc Scribble,
Guard Malloc,
Zombies.
Set CFNETWORK_DIAGNOSTICS=3 and collected Console logs.
Stress-tested the app (rapid typing, filter switching, background/foreground, poor network with Network Link Conditioner).
Could not reproduce the crash locally.
So far:
Logs show unrelated performance faults (I/O on main thread, CLLocationManager delegate), but no obvious CFNetwork misuse.
My suspicion is a URLSession lifetime or delegate/auth-challenge race, but I can’t confirm because I can’t trigger it.
Since starting this investigation, I also refactored some of my singletons into @State/@ObservedObject dependencies. For example, my app root now wires up AuthManager, BackendService, and AccountManager (where API calls happen using async/await) as @State properties:
@State var authManager: AuthManager
@State var accountManager: AccountManager
@State var backendService: BackendService
init() {
let authManager = AuthManager()
self._authManager = .init(wrappedValue: authManager)
let backendService = BackendService(authManager: authManager)
self._backendService = .init(wrappedValue: backendService)
self._accountManager = .init(wrappedValue: AccountManager(backendService: backendService))
}
I don’t know if this refactor is related to the crash, but I am including it to be complete.
Apologies that I don’t have a minimized sample project — this issue seems app-wide, and all I have are the crash logs.
Request:
Given the crash location (URLConnectionLoader::loadWithWhatToDo), can Apple provide guidance on known scenarios or misuses that can lead to this crash?
Is there a way to get more actionable diagnostics from CFNetwork beyond CFNETWORK_DIAGNOSTICS to pinpoint whether it’s session lifetime, cached response corruption, or auth/redirect?
Can you also confirm whether my dependency setup above could contribute to URLSession or backend lifetime issues?
I can’t reliably reproduce the crash, and without Apple’s insight the stack trace is effectively opaque to me.
Thanks for your time and help. Happy to send multiple symbolicated crash logs at request.
Thanks for any help.
PS. Including 2 of many similar crash logs. Can provide more if needed.
Atlans-2025-07-29-154915_symbolicated (cfloader).txt
Atlans-2025-08-08-124226_symbolicated (cfloader).txt
I tried the new WebView api in swiftui and tried to pass webPage for this view to be able to control the navigation of the user by giving him the option to go back or forward using nav buttons but the view doesn't get's updated when the webPage.backForwardList.backList so the buttons remains disabled.
code snippet:
@available(iOS 26, *)
struct LinkWebViewFor26: View {
let url: URL
@State var webPage = WebPage()
@Environment(\.dismiss) private var dismiss
var body: some View {
WebView(webPage)
.webViewBackForwardNavigationGestures(.disabled)
.task { webPage.load(url) }
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
dismiss()
} label: {
Image(systemName: "checkmark")
}
.buttonStyle(.glassProminent)
}
ToolbarItemGroup(placement: .topBarLeading) {
BackForwardMenu(
list: webPage.backForwardList.backList,
label: .init(text: "Backward", systemImage: "chevron.backward")
) { item in
webPage.load(item)
}
BackForwardMenu(
list: webPage.backForwardList.forwardList.reversed(),
label: .init(text: "Forward", systemImage: "chevron.forward")
) { item in
webPage.load(item)
}
}
}
.onChange(of: webPage.backForwardList) { _, _ in
print(webPage.backForwardList.backList)
}
}
}
I currently have a SwiftUI TabView that has 5 Tab's. The first tab has a UIScrollView in a UIViewRepresentible with scrollView.scrollsToTop = false and that works fine for when the user hits the navigation bar, however if the user taps the first tab when it is already selected my UIScrollView scrolls to top.
My UIScrollView is essentially 5 views, a center view, top, bottom, right, and left view. All views except for the center are offscreen but available for the user to scroll horizontal or vertical (and the respective views get updated based on the new center view).
The issue I have is that clicking the first tab when its already selected, sets the content offset (for the y axis) to 0, which messes me up 2x, first it scrolls up but since its not really scrolling the right, left, and upper views dont exist, which makes the user think it can't be scrolled or it's broken.
For now I subclassed UIScrollView like this
class NoScrollToTopScrollView: UIScrollView {
override func setContentOffset(_ contentOffset: CGPoint, animated: Bool) {
if contentOffset.y == .zero {
// Ignore SwiftUI’s re-tap scroll-to-top
return
}
super.setContentOffset(contentOffset, animated: animated)
}
}
which seems to work, but I'm just wondering if there is a better way to do this, or maybe a way to disable SwiftUI Tab from doing its default action which can help with a SwiftUI ScrollView as well?
I updated my App to iOS26 and I have some strange tinting with Liquid Glass elements.
Sometime the elements are tinted and sometime not. Look at the screenshots. This is the same view, without any changes.
Just go back and forth to see the different Button tinting.
And this is not just happing in the View. It happens all over the app.
Why is this happening?
I have SwiftData models containing arrays of Codable structs that worked fine before adding CloudKit capability. I believe they are the reason I started seeing errors after enabling CloudKit.
Example model:
@Model
final class ProtocolMedication {
var times: [SchedulingTime] = [] // SchedulingTime is Codable
// other properties...
}
After enabling CloudKit, I get this error logged to the console:
'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
CloudKit Console shows this times data as "plain text" instead of "bplist" format.
Other struct/enum properties display correctly (I think) as "bplist" in CloudKit Console.
The local SwiftData storage handled these arrays fine - this issue only appeared with CloudKit integration.
What's the recommended approach for storing arrays of Codable structs in SwiftData models that sync with CloudKit?
If you create a SwiftUI App where a ‘.sheet’ is presented and use a NavigationStack within that Sheet, when you use NavigationLink to present a view, the title of the Nav Bar will start at a height of 46px and pop to the Default Height of 54px when it loads causing a visual pop in the UI.
In iOS 18 it functions correctly, in iOS 26 the visual pop is present. This impacts both inline and large styles, if you disable the back button it is still present, the only way I have discovered to get rid of it is by using 'fullScreenCover' instead of '.sheet'. This feels like buggy UI. This issue has been present since iOS 26 Beta 5, I was hoping it would be fixed but is still present in the GM.
Feedback has been filed via Feedback Assistant:
FB20228369
This is the code to re-produce the issue:
import SwiftUI
struct ContentView: View {
@State private var showSheet: Bool = false
var body: some View {
VStack {
Button {
showSheet.toggle()
} label: {
Text("Show Sheet")
}
}
.padding()
.sheet(isPresented: $showSheet) {
NavigationStack {
List {
NavigationLink {
Rectangle()
.foregroundStyle(.red)
.navigationTitle("Red")
} label: {
Text("Show Red")
}
}
}
.presentationSizing(.page)
}
}
}
#Preview {
ContentView()
}