how can I show different view than collection view cell when long pressing for the context menu?

Generated on 8/5/2024

1 search

To show a different view than a collection view cell when long pressing for the context menu, you can use the new API refinements in AppKit. Specifically, you can influence the positioning of context menus by setting a value for the menu property of your view. This will automatically position the menu over the view's bounds. If your view draws a custom selection, you can implement the NSViewContentSelectionInfo protocol to provide geometry information about the selection, ensuring the menu is positioned appropriately near the selection.

For more details, you can refer to the session What’s new in AppKit at the timestamp 08:49.

Relevant Sessions

  1. What’s new in AppKit
  2. Enhance your UI animations and transitions
Catch up on accessibility in SwiftUI

Catch up on accessibility in SwiftUI

SwiftUI makes it easy to build amazing experiences that are accessible to everyone. We’ll discover how assistive technologies understand and navigate your app through the rich accessibility elements provided by SwiftUI. We’ll also discuss how you can further customize these experiences by providing more information about your app’s content and interactions by using accessibility modifiers.

Get started with Dynamic Type

Get started with Dynamic Type

Dynamic Type lets people choose their preferred text size across the system and all of their apps. To help you get started supporting Dynamic Type, we’ll cover the fundamentals: How it works, how to find issues with scaling text in your app, and how to take practical steps using SwiftUI and UIKit to create a great Dynamic Type experience. We’ll also show how you can best use the Large Content Viewer to make navigation controls accessible to everyone.

What’s new in AppKit

What’s new in AppKit

Discover the latest advances in Mac app development. Get an overview of the new features in macOS Sequoia, and how to adopt them in your app. Explore new ways to integrate your existing code with SwiftUI. Learn about the improvements made to numerous AppKit controls, like toolbars, menus, text input, and more.

Enhance your UI animations and transitions

Enhance your UI animations and transitions

Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.

Evolve your document launch experience

Evolve your document launch experience

Make your document-based app stand out, and bring its unique identity into focus with the new document launch experience. Learn how to leverage the new API to customize the first screen people see when they launch your app. Utilize the new system-provided design, and amend it with custom actions, delightful decorative views, and impressive animations.