{"id":27883057,"url":"https://github.com/honqii/contextmenumodifier","last_synced_at":"2025-05-05T06:11:38.687Z","repository":{"id":186228593,"uuid":"371324499","full_name":"HonQii/ContextMenuModifier","owner":"HonQii","description":"Simply convert UIContextMenuInteraction to SwiftUI Modifier","archived":false,"fork":false,"pushed_at":"2021-05-30T01:16:32.000Z","size":6912,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-08-05T02:37:38.144Z","etag":null,"topics":["context-menu","contextmenu","modifier","swift","swiftui","swiftui-components"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HonQii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-05-27T09:51:43.000Z","updated_at":"2023-08-05T02:37:40.897Z","dependencies_parsed_at":"2024-07-23T03:33:24.406Z","dependency_job_id":null,"html_url":"https://github.com/HonQii/ContextMenuModifier","commit_stats":null,"previous_names":["honqii/contextmenumodifier"],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonQii%2FContextMenuModifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonQii%2FContextMenuModifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonQii%2FContextMenuModifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonQii%2FContextMenuModifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HonQii","download_url":"https://codeload.github.com/HonQii/ContextMenuModifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252448586,"owners_count":21749495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context-menu","contextmenu","modifier","swift","swiftui","swiftui-components"],"created_at":"2025-05-05T06:11:37.979Z","updated_at":"2025-05-05T06:11:38.678Z","avatar_url":"https://github.com/HonQii.png","language":"Swift","readme":"# ContextMenuModifier\n\nSimply convert UIContextMenuInteraction to SwiftUI Modifier\n\n## Usage\n\nimport the package in the file you would like to use it: `import ContextMenuModifier`\n\nYou can use it as system `.contextMenu` modifier\n\n### Display custom view as context menu preview\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"./Resources/context_menu.gif\" alt=\"custom preview\" width=\"280\"\u003e\n\u003c/div\u003e\n\ncode:\n\n```swift\nText(\"Popup custom preview!\")\n    .previewContextMenu(preview: VStack {\n        Image(systemName: \"face.smiling\")\n            .font(.largeTitle)\n            .foregroundColor(Color(UIColor.systemYellow))\n        Text(\"This is another preview content\")\n    }, actions: [\n        UIAction(title: \"Only Title\", handler: { _ in }),\n        UIAction(title: \"Title with image\", image: UIImage(systemName: \"plus\"), handler: { _ in }),\n        UIAction(title: \"Desctructive action\", attributes: .destructive, handler: { _ in })\n    ])\n```\n\n### Display destination as preview \n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"./Resources/menu_destination.gif\" alt=\"destination view\" width=\"280\"\u003e\n\u003c/div\u003e\n\ncode:\n\n```swift\nText(\"Popup destination as preview!\")\n    .previewContextMenu(destination: Text(\"This is destination view\"), actions: [\n        UIAction(title: \"Only Title\", handler: { _ in }),\n        UIAction(title: \"Title with image\", image: UIImage(systemName: \"plus\"), handler: { _ in }),\n        UIAction(title: \"Desctructive action\", attributes: .destructive, handler: { _ in })\n    ])\n```\n\n### Custom context preview and destination\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"./Resources/custom_menu_destination.gif\" alt=\"preview and destination\" width=\"280\"\u003e\n\u003c/div\u003e\n\ncode:\n\n```swift\nText(\"Popup custom preview and destination!\")\n    .previewContextMenu(\n        destination: Text(\"This is custom destination view\"),\n        preview: VStack {\n            Image(systemName: \"face.smiling\")\n                .font(.largeTitle)\n                .foregroundColor(Color(UIColor.systemYellow))\n            Text(\"This is another preview content\")\n        },\n        actions: [\n            UIAction(title: \"Only Title\", handler: { _ in }),\n            UIAction(title: \"Title with image\", image: UIImage(systemName: \"plus\"), handler: { _ in }),\n            UIAction(title: \"Desctructive action\", attributes: .destructive, handler: { _ in })\n        ]\n    )\n```\n\n### Custom preferred size for preview \n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"./Resources/custom_preview_size.gif\" alt=\"preferred size preview\" width=\"280\"\u003e\n\u003c/div\u003e\n\n```code\nText(\"Custom Preview and destination with custom size!\")\n    .previewContextMenu(\n        destination: VStack {\n            Image(systemName: \"face.smiling\")\n                .font(.largeTitle)\n                .foregroundColor(Color(UIColor.systemYellow))\n            Text(\"This is another preview content\")\n        },\n        preview: Text(\"This is another preview content\"),\n        preferredContentSize: .init(width: 200, height: 200),\n        actions: [\n            UIAction(title: \"Only Title\", handler: { _ in }),\n            UIAction(title: \"Title with image\", image: UIImage(systemName: \"plus\"), handler: { _ in }),\n            UIAction(title: \"Desctructive action\", attributes: .destructive, handler: { _ in })\n        ]\n    )\n```\n\n### Popup destination view as sheet\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"./Resources/menu_sheet.gif\" alt=\"sheet destination\" width=\"280\"\u003e\n\u003c/div\u003e\n\ncode:\n\n```swift\nText(\"Popup destination as sheet\")\n    .previewContextMenu(\n        destination: VStack {\n            Image(systemName: \"face.smiling\")\n                .font(.largeTitle)\n                .foregroundColor(Color(UIColor.systemYellow))\n            Text(\"This is another preview content\")\n        },\n        preview: Text(\"This is another preview content\"),\n        presentAsSheet: true,\n        actions: [\n            UIAction(title: \"Only Title\", handler: { _ in }),\n            UIAction(title: \"Title with image\", image: UIImage(systemName: \"plus\"), handler: { _ in }),\n            UIAction(title: \"Desctructive action\", attributes: .destructive, handler: { _ in })\n        ]\n    )\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonqii%2Fcontextmenumodifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonqii%2Fcontextmenumodifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonqii%2Fcontextmenumodifier/lists"}