Sample code fails to compile with Xcode 14.1 beta 3 (14B5033e) as contextAction
has been removed/replaced.
// Compile error: Value of type 'some View' has no member 'contextAction'
#if os(macOS)
.contextAction(forSelectionType: Book.ID.self) { books in
It looks like it has been replaced with contextMenu(forSelectionType:menu)
with a slight difference.
What is the actual problem? Which sample code fails to compile?
The old modifier, contextAction(forSelectionType:action:)
, was removed and its functionality was added to the contextMenu(forSelectionType:menu:primaryAction:)
modifier.
It is now used like this:
.contextMenu(forType: Book.ID.self, menu: { _ in }) { books in
// perform primary action
}
That's just what happens during the beta period: things are added, removed and modified. It's the final version that counts.