I have an iOS and iPadOS app that also runs on macOS Catalyst. The user is able to view their subscription using the SubscriptionStoreView with two SubscriptionOptionGroups.
The documentation does not mention these are supported on macOS Catalyst and the app crashes when attempting to show the SubscriptionStoreView on macOS Catalyst.
If not supported, how can the user manage their subscription on macOS?
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
I am trying the simplest use of attachment in realityKit and get Contextual closure type @MainActor, @Sendable (inout RealityViewCameraContent) async -> void expects 1 argument, but 2 were used in closure body.
Also i get cannot find Attachment in scope
Hi everyone!
I've encountered an issue on Mac Catalyst: using the latest inspector modifier causes abnormal Sidebar and Columns state in NavigationSplitView.
Sample Code:
struct ContentView: View {
@State private var isPresented = false
var body: some View {
NavigationSplitView {
List {
ForEach(0..<20, id: \.self) { item in
Text("Item \(item)")
}
}
} content: {
List {
ForEach(0..<20, id: \.self) { item in
Text("Item \(item)")
}
}
} detail: {
List {
}
}
.inspector(isPresented: $isPresented) {
Form {
}
}
}
}
Steps to reproduce:
Xcode 16 beta 7, create a new iOS project
Paste the code above
Enable Mac Catalyst
Run on Mac (macOS 15 beta 9)
Press Command+N three times to open 3 new windows
Click the Sidebar Toggle button
The issue occurs (see screenshot below)
Through testing, I found that as long as the inspector modifier is attached, the issue occurs.
Also, the problem only appears in the 3rd and subsequent newly opened windows—the first two windows work as expected.
FB20061521
Is there a way to display a .icon file in SwiftUI? I want to show the app icon in the app itself but exporting and including the app icon as a PNG feels redundant. This would consume a lot of unnecessary storage especially when including a lot of alternative app icons. There has to be a better way
Otherwise I would file a feedback for that
Thank you
.popover(isPresented: modifier doesn't work on Mac Catalyst when attached to the item in the toolbar. The app crashes on button click, when trying to present the popover.
iOS 26 RC (macOS 26 RC)
Feedback ID - FB20145491
import SwiftUI
struct ContentView: View {
@State private var isPresented: Bool = false
var body: some View {
NavigationStack {
Text("Hello, world!")
.toolbar {
ToolbarItem(placement: .automatic) {
Button(action: {
self.isPresented.toggle()
}) {
Text("Toggle popover")
}
.popover(isPresented: $isPresented) {
Text("Hello, world!")
}
}
}
}
}
}
#Preview {
ContentView()
}
Structs are value types, and the SwiftUI gets reinitialized many times throughout its lifecycle. Whenever it gets reinitialized, would the reference that the delegator has of it still work if the View uses @State or @StateObject that hold a persistent reference to the views data?
protocol MyDelegate: AnyObject {
func didDoSomething()
}
class Delegator {
weak var delegate: MyDelegate?
func trigger() {
delegate?.didDoSomething()
}
}
struct ContentView: View, MyDelegate {
private let delegator = Delegator()
@State counter = 1
var body: some View {
VStack {
Text("\(counter)")
Button("Trigger") {
delegator.trigger()
}
}
}
func didDoSomething() {
counter += 1 //would this call update the counter in the view even if the view's instance is copied over to the delegator?
}
}
I'm trying to add a confirmationDialog to an app, so that the user can select an option from a menu that comes up from the bottom of the screen. This works perfectly for an iOS 18 simulator, but the behavior changes when the simulator is running iOS 26.1.
Is this the intended behavior of .confirmationDialog in iOS 26.1?
We're seeing sporadic crashes on devices running iOS 18.1 - both beta and release builds (22B83). The stack trace is always identical, a snippet of it below. As you can tell from the trace, it's happening in places we embed SwiftUI into UIKit via UIHostingController.
Anyone else seeing this?
4 libobjc.A.dylib 0xbe2c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 30
5 libobjc.A.dylib 0xb040 weak_register_no_lock + 396
6 libobjc.A.dylib 0xac50 objc_storeWeak + 472
7 libswiftCore.dylib 0x43ac34 swift_unknownObjectWeakAssign + 24
8 SwiftUI 0xeb74c8 _UIHostingView.base.getter + 160
9 SwiftUI 0x92124 _UIHostingView.layoutSubviews() + 112
10 SwiftUI 0x47860 @objc _UIHostingView.layoutSubviews() + 36
I’m trying to understand the expected behavior of TabView when using .tabViewStyle(.page) on iPadOS with a hardware keyboard.
When I place a TabView in page mode, swipe gestures correctly move between pages. However, left and right arrow keys do nothing by default, even when the view is made focusable. This feels a bit surprising, since paging with arrow keys seems like a natural keyboard interaction when a keyboard is attached.
Right now, to get arrow-key navigation working, I have to manually:
Make the view focusable
Listen for arrow key presses
Update the selection state manually
This works, but it feels a little tedious for something that seems like it could be built-in.
import SwiftUI
struct PageTabsExample: View {
@State private var selection = 0
private let pageCount = 3
var body: some View {
TabView(selection: $selection) {
Color.red.tag(0)
Color.blue.tag(1)
Color.green.tag(2)
}
.tabViewStyle(.page)
.indexViewStyle(.page)
.focusable(true)
.onKeyPress(.leftArrow) {
guard selection > 0 else { return .ignored }
selection -= 1
return .handled
}
.onKeyPress(.rightArrow) {
guard selection < pageCount - 1 else { return .ignored }
selection += 1
return .handled
}
}
}
My questions:
Is this lack of default keyboard paging for page-style TabView intentional on iPadOS with a hardware keyboard?
Is there a built-in way to enable arrow-key navigation for page-style TabView, or is manual handling the expected approach?
Does my approach above look like the “SwiftUI-correct” way to do this, or is there a better pattern for integrating keyboard navigation with paging?
For this kind of behavior, is it generally recommended to use .onKeyPress like I’m doing here, or would .keyboardShortcut be more appropriate (for example, wiring arrow keys to actions instead)?
Any guidance or clarification would be greatly appreciated. I just want to make sure I’m not missing a simpler or more idiomatic solution.
Thanks!
Looking to see if anyone has experienced this issue, and is aware of any workarounds.
With an app migrating towards SwiftUI Views but still using UIKit for primary navigation, my app makes use of UIHostingController to push SwiftUI Views onto a UINavigationController stack in a lot of areas. With iOS 26, I notice that SwiftUI's Menu view really struggles to present when contained in a UIHostingController. An error is logged to the console on presentation, and depending on the UI, the Menu won't present inside of it's container, or will jump around the screen.
The bug, it seems is based in a private class UIReparentingView and I am curious if anyone has found a work around for this issue. The error reported is:
Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead.
The simplest way to see this issue is to create a new storyboard based project. From the ViewController present a UIHostingController with a SwiftUI view that has a Menu and then simply tap to open the Menu. Thanks for any input!
I am trying to implement a common UX/UI pattern: one view with rounded corners transitioning to a view that fills the screen (N.B. having the display's corner radius).
I got this to work if both corner radiuses are equal to that of the display (see first GIF).
However, I cannot seem to get it to work for arbitrary corner radiuses of the smaller view (i.e., the one that does not fill the screen).
I expected the be able to combine ContainerRelativeShape with .containerShape (see code), but this left me with a broken transition animation (see second GIF).
import SwiftUI
struct ContentView: View {
@Namespace private var animation
@State private var selectedIndex: Int?
var body: some View {
ZStack {
if let selectedIndex = selectedIndex {
ContainerRelativeShape()
.fill(Color(uiColor: .systemGray3))
.matchedGeometryEffect(id: "square-\(selectedIndex)", in: animation)
.ignoresSafeArea()
.onTapGesture {
withAnimation() {
self.selectedIndex = nil
}
}
.zIndex(1)
}
ScrollView {
VStack(spacing: 16) {
ForEach(0..<20, id: \.self) { index in
if selectedIndex != index {
ContainerRelativeShape() // But what if I want some other corner radius to start with?
.fill(Color(uiColor: .systemGray5))
.matchedGeometryEffect(id: "square-\(index)", in: animation)
.aspectRatio(1, contentMode: .fit)
.padding(.horizontal, 12)
.onTapGesture {
withAnimation() {
selectedIndex = index
}
}
// .containerShape(RoundedRectangle(cornerRadius: 20))
// I can add this to change the corner radius, but this breaks the transition of the corners
} else {
Color.clear
.aspectRatio(1, contentMode: .fit)
.padding(.horizontal, 12)
}
}
}
.padding(.vertical, 16)
}
}
}
}
#Preview {
ContentView()
}
What am I missing here? How can I get this to work? And where is the mistake in my reasoning?
I have a view inside a Swift Package that relies on an external Swift Package. My Preview Canvas breaks as soon as I use code from the external package:
import ComplexModule // From swift-numerics
import SwiftUI
struct MyView: View {
// Commenting out this line will make Previews work
let number: Complex<Double> = 123
var body: some View {
Text("Hello World")
}
}
#Preview {
MyView()
}
This is part of the error the preview emits:
== PREVIEW UPDATE ERROR:
GroupRecordingError
Error encountered during update group #33
==================================
| [Remote] JITError: Runtime linking failure
|
| Additional Link Time Errors:
| Symbols not found: [ _$sSd10RealModule0A0AAMc, _$s13ComplexModule0A0VMn, _$s13ComplexModule0A0V14integerLiteralACyxG07IntegerD4TypeQz_tcfC ]
|
| ==================================
|
| | [Remote] LLVMError
| |
| | LLVMError: LLVMError(description: "Failed to materialize symbols: { (static-MyTarget, { __replacement_tag$1 }) }")
Did anyone else see this before?
I see the logo all over the internet, but the only Official logo I can find is the swift logo, the orange one, but the blue one I do not see a place to download it nor the usage guidelines. I have seen it on various Icon site like Icon8. I would like to use it on my reddit forum that is dedicated to SwiftUI but I want to be legal. Is it allowed to use and if so, where can you download the official verison?
In my code I use a binding that use 2 methods to get and get a value. There is no problem with swift 5 but when I swift to swift 6 the compiler fails :
Here a sample example of code to reproduce the problem :
`import SwiftUI
struct ContentView: View {
@State private var isOn = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Toggle("change it", isOn: Binding(get: getValue, set: setValue(_:)))
}
.padding()
}
private func getValue() -> Bool {
isOn
}
private func setValue(_ value: Bool) {
isOn = value
}
}`
Xcode compiler log error :
1. Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) 2. Compiling with the current language version 3. While evaluating request IRGenRequest(IR Generation for file "/Users/xavierrouet/Developer/TestCompilBindingSwift6/TestCompilBindingSwift6/ContentView.swift") 4. While emitting IR SIL function "@$sSbScA_pSgIeAghyg_SbIeAghn_TR". for <<debugloc at "<compiler-generated>":0:0>>Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x000000010910ae24 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000109108c5c llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010910b460 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x0000000188e60624 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000188e2688c pthread_kill + 296
5 libsystem_c.dylib 0x0000000188d2fc60 abort + 124
6 swift-frontend 0x00000001032ff9a8 swift::DiagnosticHelper::~DiagnosticHelper() + 0
7 swift-frontend 0x000000010907a878 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8 swift-frontend 0x00000001090aef6c report_at_maximum_capacity(unsigned long) + 0
9 swift-frontend 0x00000001090aec7c llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 384
10 swift-frontend 0x000000010339c418 (anonymous namespace)::SyncCallEmission::setArgs(swift::irgen::Explosion&, bool, swift::irgen::WitnessMetadata*) + 892
11 swift-frontend 0x00000001035f8104 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 4792
12 swift-frontend 0x00000001035c876c (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 2636
13 swift-frontend 0x00000001035c6614 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 15860
14 swift-frontend 0x00000001035c2368 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2788
15 swift-frontend 0x00000001033e7c1c swift::irgen::IRGenerator::emitLazyDefinitions() + 5288
16 swift-frontend 0x0000000103573d6c swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4528
17 swift-frontend 0x00000001035c15c4 swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 180
18 swift-frontend 0x000000010357d1b0 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatalswift::IRGenRequest(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatalswift::IRGenRequest(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 812
19 swift-frontend 0x0000000103576910 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 176
20 swift-frontend 0x0000000102f61af0 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>) + 156
21 swift-frontend 0x0000000102f5d07c performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 2108
22 swift-frontend 0x0000000102f5c0a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
23 swift-frontend 0x0000000102f5f654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
24 swift-frontend 0x0000000102f5dfd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
25 swift-frontend 0x0000000102ee20bc swift::mainEntry(int, char const**) + 5428
26 dyld 0x0000000188a86b98 start + 6076
Using Xcode 16.4 / Mac OS 16.4
It has been two years since I wrote my a SwiftUI app, and I wanted to start again in Xcode 26. I can no longer see the attributes inspector when I select an element in the canvas. This was an Xcode feature that was very helpful as I am still a novice. Has this feature been deprecated in Xcode 26? And if not, please help explain how I can find and use it.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Developer Tools
Interface Builder
Xcode
SwiftUI
Hi everyone,
I’m working on a screen that uses a single SwiftUI List composed of:
a top block (statistics, month picker, year selector, total, Entrata/Uscita picker).
a list of transactions grouped by day, each group inside its own Section.
each row is a fully custom card with rounded corners (RoundedCornerShape)
I’m correctly removing all separators using:
.listRowSeparator(.hidden)
.listSectionSeparator(.hidden)
.scrollContentBackground(.hidden)
.listStyle(.plain)
Each row is rendered like this:
TransazioneSwipeRowView(...)
.listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
.listRowBackground(Color.clear)
However, I still see thin horizontal lines appearing between:
the search bar and the top block
the top block and the start of the list
between rows inside the grouped section
sometimes at the bottom of a Section
These lines are NOT:
Divider()
system separators
backgrounds
row borders
They seem to be “ghost lines” automatically generated by SwiftUI’s List when multiple consecutive rows or sections are present.
Goal
I want to remove these lines completely while keeping:
native SwiftUI List
native scroll behavior
swipe-to-delete support
grouping by Section
custom card-like rows with rounded corners
transparent backgrounds
What I already tried
.plain, .grouped, .insetGrouped list styles
.listRowSeparator(.hidden) and .listSectionSeparator(.hidden)
.scrollContentBackground(.hidden)
clearing all backgrounds
adjusting/removing all padding and insets
Spacer(minLength: 0) experiments
rebuilding the layout using ScrollView + LazyVStack
(works perfectly — no lines — BUT loses native swipe-to-delete)
There are no Divider() calls anywhere, and no background colors producing borders.
Question
Is this a built-in behavior of SwiftUI’s List in .plain style when using multiple custom rows,
or is there an officially supported way to eliminate these lines entirely?
Is there a recommended combination of modifiers to achieve:
a List with grouped Sections
fully custom rows with rounded backgrounds
absolutely no horizontal separators, even in the empty spaces between sections?
Any guidance, documented workarounds, WWDC references, or official recommendations would be greatly appreciated.
Thanks in advance!
Hello everyone!
I found a weird behavior with the animation of Menucomponent on iOS 26.1
When the menu disappear the animation is very glitchy
You can find here a sample of code to reproduce it
@available(iOS 26.0, *)
struct MenuSample: View {
var body: some View {
GlassEffectContainer {
HStack {
Menu {
Button("Action 1") {}
Button("Action 2") {}
Button("Delete", role: .destructive) {}
} label: {
Image(systemName: "ellipsis")
.padding()
}
Button {} label: {
Image(systemName: "xmark")
.padding()
}
}
.glassEffect(.clear.interactive())
}
}
}
@available(iOS 26.0, *)
#Preview {
MenuSample()
.preferredColorScheme(.dark)
}
I did two videos:
iOS 26.0
iOS 26.1
Thanks for your help
I want to support Genmoji input in my SwiftUI TextField or TextEditor, but looking around, it seems there's no SwiftUI only way to do it?
If none, it's kind of disappointing that they're saying SwiftUI is the path forward, but not updating it with support for new technologies.
Going back, does this mean we can only support Genmoji through UITextField and UIViewRepresentable? or there more direct options?
Btw, I'm also using SwiftData for storage.
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've been struggling with this issue since the release of macOS 15 Sequoia. I'm wondering if anyone else has encountered it or if anyone has a workaround to fix it.
Inserting a new element into the array that acts as data source for a SwiftUI List with a ForEach is never animated even if the insertion is wrapped in a withAnimation() call.
It seems that some other changes can be automated though: e.g. calls to shuffle() on the array successfully animate the changes.
This used to work fine on macOS 14, but stopped working on macOS 15.
I created a very simple project to reproduce the issue:
import SwiftUI
@main
struct TestApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct IdentifiableItem: Identifiable {
let id = UUID()
var name: String { "Item \(id)" }
}
struct ContentView: View {
@State var items: [IdentifiableItem] = [
IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(),
IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(),
]
var body: some View {
List {
ForEach(items) { item in
Text(item.name)
}
}
Button("Add Item") {
withAnimation {
items.insert(IdentifiableItem(), at: 0)
}
}
Button("Shuffle Items") {
withAnimation {
items.shuffle()
}
}
}
}
How to reproduce
Copy the code below in an Xcode project.
Run it on macOS 15.
Hit the "Add Item" button
Expected: A new item is inserted with animation.
Result: A new item is inserted without animation.
How to prove this is a regression
Follow the same steps above but run on macOS 14.
A new item is inserted with animation.