{"id":7287815,"url":"https://github.com/simonbs/KeyboardToolbar","last_synced_at":"2025-03-13T21:31:58.402Z","repository":{"id":40677328,"uuid":"507650395","full_name":"simonbs/KeyboardToolbar","owner":"simonbs","description":"⌨️ Add tools above your keyboard with iOS-like keyboard buttons.","archived":false,"fork":false,"pushed_at":"2024-01-15T09:56:49.000Z","size":114,"stargazers_count":246,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-17T09:18:22.090Z","etag":null,"topics":["ios","swift"],"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/simonbs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"simonbs"}},"created_at":"2022-06-26T18:13:29.000Z","updated_at":"2025-02-13T10:50:11.000Z","dependencies_parsed_at":"2024-01-15T11:08:36.566Z","dependency_job_id":"5bb70033-bcdb-4bb0-a7b0-54d6bc8c8a08","html_url":"https://github.com/simonbs/KeyboardToolbar","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"77292529fc436541c5d31664d263460778060210"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FKeyboardToolbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FKeyboardToolbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FKeyboardToolbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FKeyboardToolbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonbs","download_url":"https://codeload.github.com/simonbs/KeyboardToolbar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243004128,"owners_count":20220237,"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":["ios","swift"],"created_at":"2024-04-03T08:03:08.026Z","updated_at":"2025-03-13T21:31:58.027Z","avatar_url":"https://github.com/simonbs.png","language":"Swift","funding_links":["https://github.com/sponsors/simonbs"],"categories":["Swift"],"sub_categories":[],"readme":"# KeyboardToolbar\n\n![](Sources/KeyboardToolbar/Documentation.docc/Resources/keyboard.png#gh-light-mode-only)\n![](Sources/KeyboardToolbar/Documentation.docc/Resources/keyboard~dark.png#gh-dark-mode-only)\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsimonbs%2FKeyboardToolbar%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/simonbs/KeyboardToolbar)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsimonbs%2FKeyboardToolbar%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/simonbs/KeyboardToolbar)\n[![](https://img.shields.io/badge/twitter-@simonbs-blue.svg?style=flat)]([https://swiftpackageindex.com/simonbs/Runestone](https://twitter.com/simonbs))\n\n## 👀 Overview\n\nUse KeyboardToolbar to add tools as an input accessory view to a UITextField, UITextView, or any other view conforming to UITextInput.\n\nKeyboardToolbar creates buttons with an iOS-like appearance and behavior.\n\n## 📖 Documentation\n\nThe public interface is documented in the Swift files and can be found in [KeyboardToolbar/Sources/KeyboardToolbar](https://github.com/simonbs/KeyboardToolbar/tree/main/Sources/KeyboardToolbar). You can also [read the documention on Swift Package Index](https://swiftpackageindex.com/simonbs/KeyboardToolbar).\n\nLastly, you can also build the documentation yourself by opening the Swift package in Xcode and selecting Product \u003e Build Documentation in the menu bar.\n\n## 📦 Adding the Package\n\nKeyboardToolbar is distributed using the [Swift Package Manager](https://www.swift.org/package-manager/). Install it in a project by adding it as a dependency in your Package.swift manifest or through “Package Dependencies” in project settings.\n\n```swift\nlet package = Package(\n    dependencies: [\n        .package(url: \"git@github.com:simonbs/KeyboardToolbar.git\", from: \"0.1.0\")\n    ]\n)\n```\n\n## 🚀 Getting Started\n\nThe best way to understand how KeyboardToolbar is integrated into your project is by having a look at the [Example project](Example/Example) in this repository.\n\nAt a high level there are two steps required to setting up the keyboard toolbar.\n\n1. Create an instance of [KeyboardToolbarView](https://github.com/simonbs/KeyboardToolbar/blob/main/Sources/KeyboardToolbar/KeyboardToolbarView.swift) and assign it to [inputAccessoryView](https://developer.apple.com/documentation/uikit/uitextfield/1619627-inputaccessoryview) on a UITextField, UITextView, or any other view that conforms to the UITextInput protocol.\n2. Assign an array of [KeyboardToolGroup](https://github.com/simonbs/KeyboardToolbar/blob/main/Sources/KeyboardToolbar/KeyboardToolGroup.swift) items to the `groups` property on your instance of KeyboardToolbarView.\n\nThe below code snippet shows how the two steps can be performed.\n\n```swift\n/// Create our instance of KeyboardToolbarView and pass it to an instance of UITextView.\nlet keyboardToolbarView = KeyboardToolbarView()\ntextView.inputAccessoryView = keyboardToolbarView\n// Setup our tool groups.\nlet canUndo = textView.undoManager?.canUndo ?? false\nlet canRedo = textView.undoManager?.canRedo ?? false\nkeyboardToolbarView.groups = [\n    // Tools for undoing and redoing text in the text view.\n    KeyboardToolGroup(items: [\n        KeyboardToolGroupItem(style: .secondary, representativeTool: BlockKeyboardTool(symbolName: \"arrow.uturn.backward\") { [weak self] in\n            self?.textView.undoManager?.undo()\n            self?.setupKeyboardTools()\n        }, isEnabled: canUndo),\n        KeyboardToolGroupItem(style: .secondary, representativeTool: BlockKeyboardTool(symbolName: \"arrow.uturn.forward\") { [weak self] in\n            self?.textView.undoManager?.redo()\n            self?.setupKeyboardTools()\n        }, isEnabled: canRedo)\n    ]),\n    // Tools for inserting characters into our text view.\n    KeyboardToolGroup(items: [\n        KeyboardToolGroupItem(representativeTool: InsertTextKeyboardTool(text: \"(\", textView: textView), tools: [\n            InsertTextKeyboardTool(text: \"(\", textView: textView),\n            InsertTextKeyboardTool(text: \"{\", textView: textView),\n            InsertTextKeyboardTool(text: \"[\", textView: textView),\n            InsertTextKeyboardTool(text: \"]\", textView: textView),\n            InsertTextKeyboardTool(text: \"}\", textView: textView),\n            InsertTextKeyboardTool(text: \")\", textView: textView)\n        ]),\n        KeyboardToolGroupItem(representativeTool: InsertTextKeyboardTool(text: \".\", textView: textView), tools: [\n            InsertTextKeyboardTool(text: \".\", textView: textView),\n            InsertTextKeyboardTool(text: \",\", textView: textView),\n            InsertTextKeyboardTool(text: \";\", textView: textView),\n            InsertTextKeyboardTool(text: \"!\", textView: textView),\n            InsertTextKeyboardTool(text: \"\u0026\", textView: textView),\n            InsertTextKeyboardTool(text: \"|\", textView: textView)\n        ]),\n        KeyboardToolGroupItem(representativeTool: InsertTextKeyboardTool(text: \"=\", textView: textView), tools: [\n            InsertTextKeyboardTool(text: \"=\", textView: textView),\n            InsertTextKeyboardTool(text: \"+\", textView: textView),\n            InsertTextKeyboardTool(text: \"-\", textView: textView),\n            InsertTextKeyboardTool(text: \"/\", textView: textView),\n            InsertTextKeyboardTool(text: \"*\", textView: textView),\n            InsertTextKeyboardTool(text: \"\u003c\", textView: textView),\n            InsertTextKeyboardTool(text: \"\u003e\", textView: textView)\n        ]),\n        KeyboardToolGroupItem(representativeTool: InsertTextKeyboardTool(text: \"#\", textView: textView), tools: [\n            InsertTextKeyboardTool(text: \"#\", textView: textView),\n            InsertTextKeyboardTool(text: \"\\\"\", textView: textView),\n            InsertTextKeyboardTool(text: \"'\", textView: textView),\n            InsertTextKeyboardTool(text: \"$\", textView: textView),\n            InsertTextKeyboardTool(text: \"\\\\\", textView: textView),\n            InsertTextKeyboardTool(text: \"@\", textView: textView),\n            InsertTextKeyboardTool(text: \"%\", textView: textView),\n            InsertTextKeyboardTool(text: \"~\", textView: textView)\n        ])\n    ]),\n    KeyboardToolGroup(items: [\n        // Tool to present the find navigator.\n        KeyboardToolGroupItem(style: .secondary, representativeTool: BlockKeyboardTool(symbolName: \"magnifyingglass\") { [weak self] in\n            self?.textView.findInteraction?.presentFindNavigator(showingReplace: false)\n        }),\n        // Tool to dismiss the keyboard.\n        KeyboardToolGroupItem(style: .secondary, representativeTool: BlockKeyboardTool(symbolName: \"keyboard.chevron.compact.down\") { [weak self] in\n            self?.textView.resignFirstResponder()\n        })\n    ])\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbs%2FKeyboardToolbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonbs%2FKeyboardToolbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbs%2FKeyboardToolbar/lists"}