{"id":15717917,"url":"https://github.com/chipjarred/customtooltip","last_synced_at":"2025-05-13T02:13:40.178Z","repository":{"id":45990935,"uuid":"355199242","full_name":"chipjarred/CustomToolTip","owner":"chipjarred","description":"Easily add custom tool tips with arbitrary content to your AppKit project!","archived":false,"fork":false,"pushed_at":"2021-11-24T02:01:08.000Z","size":287,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T02:13:33.496Z","etag":null,"topics":["appkit","cocoa","macapp","macos","macosx","nsview","swift","swiftpackage","tooltip"],"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/chipjarred.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}},"created_at":"2021-04-06T13:30:35.000Z","updated_at":"2025-05-12T15:28:14.000Z","dependencies_parsed_at":"2022-08-29T22:31:30.559Z","dependency_job_id":null,"html_url":"https://github.com/chipjarred/CustomToolTip","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipjarred%2FCustomToolTip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipjarred%2FCustomToolTip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipjarred%2FCustomToolTip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chipjarred%2FCustomToolTip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chipjarred","download_url":"https://codeload.github.com/chipjarred/CustomToolTip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856665,"owners_count":21974582,"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":["appkit","cocoa","macapp","macos","macosx","nsview","swift","swiftpackage","tooltip"],"created_at":"2024-10-03T21:51:38.220Z","updated_at":"2025-05-13T02:13:40.144Z","avatar_url":"https://github.com/chipjarred.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CustomToolTip\n\nCustomToolTip is a Swift Package for macOS Cocoa applications that lets you add tool tips that can use any kind of  `NSView` for their content without having to subclass or wrap your existing views.  That means it can be easily incorporated into an existing project.\n\n![Screenshot](./Images/ScreenShot.png)\n\n## Project Set Up\n\n- Step 1: Add [https://github.com/chipjarred/CustomToolTip.git](https://github.com/chipjarred/CustomToolTip.git) as a Swift Package dependency to your project in Xcode.\n- Step 2: *There is no step 2!*\n\nCustomToolTip provides an extension on `NSView` that handles the rest.  You can focus on creating your tool tip content and attach it to your views with the `customToolTip` property that the extension adds to `NSView`.\n\nYou don't need to subclass anything. You don't need to nest views in a special tool tip view.  You don't even need to change anything in storyboards.  \n\n## How to add custom tool tips\n\nIn the source files where you want to add custom tool tips, \n\n```swift\nimport CustomToolTip\n```\nThen adding a tool tip is as easy as\n\n```swift\nmyControl.customToolTip = myCustomTipContentView\n```\nwhere `myControl`, is the view to which you want to attach a custom tool tip, and  `myCustomTipContentView` is any `NSView` you want to use as the tool tip's content.\n\nThe only technical requirement for your tool tip view is that its frame size should be properly set before adding it, as the tool tip will adjust its size according to your content view's frame.  \n\nThere are design considerations for your tool tip content, but those will largely depend on taste, the look and feel of your app, and current thought on good design.  The only suggestions I'll make are to keep your tool tips relatively small, and avoid using any view in them that looks like the user should interact with it, because... it's a tool tip.  It will disappear when the user moves the mouse.  \n\nYou can specify the margins between your custom tool tip content view, and the tool tip's window frame:\n\n```swift\nmyControl.customToolTipMargins = CGSize(width: 5, height: 5)\n```\n\nBy default CustomToolTip uses the current system window background color for the tool tip's background, but you can use any color you like:\n\n```swift\nmyControl.customToolTipBackgroundColor = NSColor.blue\n```\n\nYou can also set the default values to use when you don't specify them per view:\n\n```swift\nCustomToolTip.defaultMargins = CGSize(width: 2, height: 2)\nCustomToolTip.defaultBackColor = .controlColor\n```\n\n## Conveniences\n\nFor some especially common cases CustomToolTip provides convenience methods that will make the view for you.\n\nIf you just want to add a text tool tip using a specific font, you can do it like this:\n\n```swift\nmyControl.addCustomToolTip(from: \"This is my tool tip\", with: NSFont(name: \"Chalkboard\", size: 20))\n```\n\nIf you have an `NSAttributedString` you'd like to display in the tool tip, you can use that:\n\n```swift\nmyControl.addCustomToolTip(from: myAttributedString)\n```\n\nTo use an `NSImage` as the content:\n\n```swift\nmyControl.addCustomToolTip(from: myToolTipImage, scaling: .toFit(width: 50, height: 50))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchipjarred%2Fcustomtooltip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchipjarred%2Fcustomtooltip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchipjarred%2Fcustomtooltip/lists"}