I understand this is a known issue, but it’s truly unacceptable that it remains unresolved. Allowing users to customize toolbars is a fundamental macOS feature, and it has been broken since the release of macOS 15.
How is it possible that this issue persists even in macOS 15.3 beta (24D5040f)?
FB15513599
import SwiftUI
struct ContentView: View {
@State private var showEditItem = false
var body: some View {
VStack {
VStack {
Text("Instructions to reproduce the crash")
.font(.title)
.padding()
Text("""
1. Click on "Toggle Item"
2. In the menu go to File > New Window
3. In new window, click on "Toggle Item"
""")
}
.padding()
Button {
showEditItem.toggle()
} label: {
Text("Toggle Item")
}
}
.padding()
.toolbar(id: "main") {
ToolbarItem(id: "new") {
Button {
} label: {
Text("New…")
}
}
if showEditItem {
ToolbarItem(id: "edit") {
Button {
} label: {
Text("Edit…")
}
}
}
}
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
For some reason, a List will reset its selection to nil when the app is in the background.
Steps to reproduce the issue:
Run attached sample project
Once the app has launched, select a name in the sidebar
Move the app to the background
Wait a few seconds
Bring back the app to the foreground
Expected result:
The list selection should still be valid
Actual result:
The list selection is set to nil
Notes:
I’m using a StateObject, which should be the way to ensure that data isn’t regenerated when views are rendered. Is this a bug or something else needs to be taken care of?
class AppModel: ObservableObject {
@Published var selectedPerson: Person?
}
@main
struct NilListSelectionApp: App {
@StateObject var appModel = AppModel()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(appModel)
}
}
}
struct Person: Identifiable, Hashable {
let id: UUID
let firstname: String
init(firstname: String) {
id = UUID()
self.firstname = firstname
}
}
struct ContentView: View {
@EnvironmentObject private var appModel: AppModel
var body: some View {
NavigationSplitView {
SidebarView()
} detail: {
PersonView(person: appModel.selectedPerson)
}
}
}
struct SidebarView: View {
@EnvironmentObject private var appModel: AppModel
private let persons = [Person(firstname: "Joe"), Person(firstname: "Jane")]
var body: some View {
List(persons, id:\.self, selection: $appModel.selectedPerson) { person in
Text(person.firstname).tag(person)
}
.listStyle(.sidebar)
}
}
struct PersonView: View {
let person: Person?
var body: some View {
if let person {
Text(person.firstname)
}
else {
Text("No Selection")
}
}
}
I'm in the process of migrating to the Observation framework but it seems like it is not compatible with didSet. I cannot find information about if this is just not supported or a new approach needs to be implemented?
import Observation
@Observable class MySettings {
var windowSize: CGSize = .zero
var isInFullscreen = false
var scalingMode: ScalingMode = .scaled {
didSet {
...
}
}
...
}
This code triggers this error:
Instance member 'scalingMode' cannot be used on type 'MySettings'; did you mean to use a value of this type instead?
Anyone knows what needs to be done? Thanks!
Xcode 26.2 RC has been out for over 24 hours and it's still not possible to submit apps.
Calling DNSServiceNATPortMappingCreate returns kDNSServiceErr_NoError like expected but the port mapping actually fails right away in the callback.
I'm calling this in a daemon via XPC. Are there new restrictions or permissions required?
Since iOS/iPadOS beta 6, I get a crash just by simply selecting an item in the sidebar of a navigation view. The selected item is part of an app mode, with conforms to the Observation protocol:
import SwiftUI
import Observation
@main
struct MREAApp: App {
@State private var appModel = AppModel.shared
var body: some Scene {
WindowGroup {
ContentView()
.environment(appModel)
}
}
}
@Observable class AppModel {
static var shared = AppModel()
var selectedFolder: Folder? = nil
}
struct Folder: Hashable, Identifiable {
let id = UUID()
let name: String
}
struct ContentView: View {
@Environment(AppModel.self) private var appModel
var folders = [Folder(name: "Recents"), Folder(name: "Deleted"), Folder(name: "Custom")]
var body: some View {
NavigationSplitView {
SidebarView(appModel: appModel, folders: folders)
} detail: {
if let folder = appModel.selectedFolder {
Text(folder.name)
}
else {
Text("No selection")
}
}
}
}
struct SidebarView: View {
@Bindable var appModel: AppModel
var folders: [Folder]
var body: some View {
List(selection: $appModel.selectedFolder) {
ForEach(folders, id: \.self) { folder in
NavigationLink(value: folder) {
Text(folder.name)
}
}
}
}
}
To reproduce the bug, just tap on one of the item.
Oddly enough, this works fine in the Simulator.
macOS 14 beta 5 is not affected either.
Apple folks: FB12981860
Is there a setting am I missing or Simulator is just broken on Beta 2 and won't go on the Internet?
Xcode 12.4 is working fine. Other devs see this as well.
Nothing in the release notes.
Any workaround?