{"id":28565640,"url":"https://github.com/commencis/poptip-swiftui","last_synced_at":"2025-06-10T14:33:06.541Z","repository":{"id":288288569,"uuid":"967388728","full_name":"Commencis/poptip-SwiftUI","owner":"Commencis","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-06T10:04:44.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-06T11:26:30.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Commencis.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-16T11:34:06.000Z","updated_at":"2025-05-06T10:04:53.000Z","dependencies_parsed_at":"2025-04-16T22:49:04.006Z","dependency_job_id":null,"html_url":"https://github.com/Commencis/poptip-SwiftUI","commit_stats":null,"previous_names":["commencis/poptip-swiftui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fpoptip-SwiftUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fpoptip-SwiftUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fpoptip-SwiftUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fpoptip-SwiftUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Commencis","download_url":"https://codeload.github.com/Commencis/poptip-SwiftUI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fpoptip-SwiftUI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259093028,"owners_count":22804109,"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":[],"created_at":"2025-06-10T14:30:50.502Z","updated_at":"2025-06-10T14:33:06.534Z","avatar_url":"https://github.com/Commencis.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PopTip SwiftUI\n\nThe popTip-SwiftUI provides a flexible and customizable way to display tooltips (PopTips) in SwiftUI applications. It integrates a UIKit-based PopTip component (from [AmPoptip](https://github.com/andreamazz/AMPopTip)) with SwiftUI, allowing you to present text-based or custom SwiftUI content in a tooltip with configurable appearance and behavior. This wrapper uses a view modifier (`PopTipViewModifier`) to attach PopTips to SwiftUI views, with styling managed via `PopTipTheme` and behavior controlled through environment values.\n\n## Features\n\n- **UIKit + SwiftUI Integration**  \n  Wraps [AMPopTip](https://github.com/andreamazz/AMPopTip) for easy use in SwiftUI views.\n- **Target Highlighting**  \n  Supports transparent overlay cutouts to draw focus to the tooltip’s anchor view.\n- **Custom SwiftUI Content**  \n  Display any SwiftUI view inside the PopTip.\n- **Customizable**  \n  Full control over theme, behavior, positioning, dismissal, and interactivity.\n\n- **Target View Highlighting**:\n  Ability to use a transparent cutout in the overlay (via popTipHasOverlayTargetHole), which draws attention to the target view.\n\n## Installation\n\n### With Xcode\n\n1. In Xcode, go to `File \u003e Add Packages`.\n2. Use the URL: https://github.com/Commencis/poptip-SwiftUI\n3. Choose the latest version or specify a range.\n4. Add `\"PopTipSwiftUI\"` to your app target.\n\n### With `Package.swift`\n\nAdd this package as dependency:\n\n```swift\n.package(url: \"https://github.com/Commencis/poptip-SwiftUI\", from: \"x.y.z\")\n```\n\nAnd in your target dependencies:\n\n```swift\n.target(\n  name: \"YourApp\",\n  dependencies: [\n    .product(name: \"PopTipSwiftUI\", package: \"poptip-SwiftUI\")\n  ]\n)\n```\n\n## Usage\n\nAttach a PopTip to any SwiftUI view using the `.popTip` modifier. You control:\n\n- Presentation via `Binding\u003cBool\u003e`\n- Appearance via `PopTipTheme`\n- Content: simple text or any SwiftUI view\n\n### Plain Text PopTip\n\nShows a basic tooltip with a message and a custom theme.\n\n```swift\nButton(\"Show Plain PopTip\") {\n    showPlainTip.toggle()\n}\n.popTip(\n    isPresented: $showPlainTip,\n    message: \"This is a simple PopTip!\",\n    theme: previewTipTheme\n)\n.padding()\n.background(Color.gray.opacity(0.2))\n.cornerRadius(8)\n```\n\n### Timed PopTip with Auto-Dismiss\n\nAutomatically dismisses the tooltip after 2 seconds, and highlights the target view.\n\n```swift\nButton(\"Show Timed PopTip\") {\n    showTimerTip.toggle()\n}\n.popTip(\n    isPresented: $showTimerTip,\n    message: \"This will dismiss in 2 seconds!\",\n    theme: previewTipTheme2,\n    autoDismissDuration: 2.0\n)\n.popTipHasOverlayTargetHole(true)\n.padding()\n.background(Color.gray.opacity(0.2))\n.cornerRadius(8)\n```\n\n### Custom SwiftUI Content PopTip\n\nDisplays a fully customized SwiftUI view inside the tooltip.\n\n```swift\nButton(\"Show Custom PopTip\") {\n    showCustomTip.toggle()\n}\n.popTip(\n    isPresented: $showCustomTip,\n    theme: previewTipTheme3\n) {\n    HStack {\n        Image(systemName: \"star.fill\")\n            .foregroundColor(.yellow)\n        Text(\"Custom Content!\")\n            .font(.headline)\n            .foregroundColor(.white)\n    }\n    .padding(8)\n}\n.padding()\n.background(Color.gray.opacity(0.2))\n.cornerRadius(8)\n```\n\n## Theming \u0026 Behavior\n\n### Customize Appearance\n\nYou can style the tooltip using `PopTipTheme`:\n\n```swift\nlet customTheme = PopTipTheme(\n    bubbleColor: .purple.opacity(0.9),\n    textColor: .white,\n    font: .systemFont(ofSize: 15, weight: .bold),\n    cornerRadius: 12,\n    textAlignment: .center,\n    overlayColor: .black.opacity(0.5),\n    edgeInsets: EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10),\n    arrowSize: CGSize(width: 14, height: 7)\n)\n\nButton(\"Show Custom PopTip\") { /* Action */ }\n    .popTip(\n        isPresented: .constant(true),\n        message: \"Custom styled PopTip!\",\n        theme: customTheme\n    )\n```\n\n### Customizing Behavior\n\nUse view modifiers to configure the PopTip’s behavior and positioning. These modifiers set environment values that the PopTipViewModifier reads. You may also use `configurePopTip` API to directly access PopTip just before presented.\n\n```swift\nButton(\"Show PopTip\")\n    .popTip(\n        isPresented: .constant(true),\n        message: \"Interactive PopTip\",\n        theme: .previewTipTheme\n    )\n    .popTipDismissOnScroll(true) // Dismiss on scroll\n    .popTipMaxWidth(250) // Limit width to 250 points\n    .popTipOnTapInside { print(\"PopTip tapped!\") } // Custom tap handler\n    .popTipDismissOnTap(false) // Prevent dismissal on tap\n    .popTipDirection(.down) // Show PopTip below target\n    .popTipEdgeMargin(20) // 20-point screen edge margin\n    .popTipOffset(5) // 5-point offset from anchor\n    .popTipHasOverlayTargetHole(true) // Transparent cutout over target\n    .configurePopTip { popTip in // Custom PopTip configuration\n        popTip.animationIn = 0.8\n        popTip.animationOut = 0.4\n        popTip.shouldBounce = true\n        popTip.borderWidth = 1.0\n        popTip.borderColor = .white\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommencis%2Fpoptip-swiftui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommencis%2Fpoptip-swiftui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommencis%2Fpoptip-swiftui/lists"}