SwiftUI_visionOS_Note

.contextMenu()

Jan 11, 2024
  • Less popular than alert and sheet.
  • Another way of presenting bunch of buttons.
  • context menu is not used that much, because it’s hidden.
  • It’s only visible when user long press the screen.
 

1. Create a VStack

 

2. Add contextMenu()

 

3. Replace to button

  • Context menu only accept Text and Image.
 

4. Increase # of Like

 
 
 
  • Present a group of buttons is through a context menu.
  • It's not widely used as it's hidden and only visible through a long press.
  • Context menu also accepts a list of labels, each consisting of an icon and a title.
 

#swiftui #visionos #applevisionpro #visionpro

 

You might also like

BlogPro logo
Made with BlogPro