# Context Menu

## Overview

## Subjects

### Some Rules to Consider

* Put only important ones
* Item count should not be more than 3
* Do not repeat the context menu anywhere else

### Creating Context Menu

{% embed url="<https://youtu.be/2zYopgwzglw>" %}
[Hacking with Swift / 100 Days / Day-81 - Creating context menus](https://www.hackingwithswift.com/books/ios-swiftui/creating-context-menus)
{% endembed %}

## Sample Codes

Since context menus are used in all devices it should have consistent format. SwiftUI does not allow us to change almost any format like color or etc. . Thus with adding a sole to that can open some door for format.

```swift
Button(role:  .destructive) {}
```

<figure><img src="https://5317963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F598GXhEFvy2PX7VpZjCw%2Fuploads%2FC9KK3QpTKGzuacwufkk3%2Fimage.png?alt=media&#x26;token=e4b95bcb-6cd0-4ddb-a331-4924ca41f76f" alt=""><figcaption></figcaption></figure>

## Adding a context menu to an image

{% embed url="<https://youtu.be/YlxJPUD_lF8>" %}
[Hacking with Swift / 100 Days - Day-84 - Adding a context menu to an image](https://www.hackingwithswift.com/books/ios-swiftui/adding-a-context-menu-to-an-image)
{% endembed %}

## Sources

### Videos

### Articles / Documents

*

## See also

*
