Skip to content

edwinbosire/swiftui-context-menu-preview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Here’s a sample README for your project based on your description:


SwiftUI Context Menu with Preview

This repository demonstrates an experimental SwiftUI implementation of context menus with previews.
It showcases how to leverage the contextMenu modifier in SwiftUI to present rich, interactive previews when users long-press or right-click on UI elements.

Video Normal Context Menu
video context_menu_1 image

Features

  • SwiftUI-based: Pure SwiftUI experiment, no UIKit required.
  • Context Menus: Easily attach context menus to views.
  • Preview Support: Show previews alongside menu actions.
  • Customizable Actions: Add, remove, or modify menu options as needed.

Getting Started

  1. Clone the repository

    git clone https://github.com/edwinbosire/swiftui-context-menu-preview.git
  2. Open in Xcode
    Open the .xcodeproj or .xcworkspace file in Xcode.

  3. Run the Project
    Select a simulator or device and hit Run.

Usage

Check out the sample views in the project for examples of how to use the contextMenu modifier with previews:

YourView()
    .contextMenu {
        Button("Action 1", action: { /* ... */ })
        Button("Action 2", action: { /* ... */ })
    } preview: {
        PreviewView()
    }

License!()

MIT License. See LICENSE for details.


Let me know if you want to add installation instructions, credits, or more details!

About

Swiftui Context Menu with Preview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages