{"id":13779258,"url":"https://github.com/michaelhenry/KeyboardAvoider","last_synced_at":"2025-05-11T12:33:05.610Z","repository":{"id":56917873,"uuid":"232497298","full_name":"michaelhenry/KeyboardAvoider","owner":"michaelhenry","description":"The missing interactive keyboard in SwiftUI for iOS","archived":false,"fork":false,"pushed_at":"2020-01-29T03:29:04.000Z","size":3394,"stargazers_count":132,"open_issues_count":1,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-14T19:41:44.680Z","etag":null,"topics":["autodismisskeyboard","autokeyboard","ios","keyboard","swiftui"],"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/michaelhenry.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":"2020-01-08T06:45:32.000Z","updated_at":"2024-11-06T11:51:39.000Z","dependencies_parsed_at":"2022-08-21T04:50:51.861Z","dependency_job_id":null,"html_url":"https://github.com/michaelhenry/KeyboardAvoider","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/michaelhenry%2FKeyboardAvoider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FKeyboardAvoider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FKeyboardAvoider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2FKeyboardAvoider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhenry","download_url":"https://codeload.github.com/michaelhenry/KeyboardAvoider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225049036,"owners_count":17412915,"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":["autodismisskeyboard","autokeyboard","ios","keyboard","swiftui"],"created_at":"2024-08-03T18:01:03.181Z","updated_at":"2024-11-17T14:31:17.522Z","avatar_url":"https://github.com/michaelhenry.png","language":"Swift","funding_links":[],"categories":["TextField"],"sub_categories":["Content"],"readme":"![Screenshot](images/screenshot.gif) ![Screenshot](images/screenshot2.gif)\n\n[![Deployment status](https://github.com/michaelhenry/KeyboardAvoider/workflows/deploy_to_cocoapods/badge.svg)](https://github.com/michaelhenry/KeyboardAvoider/actions)\n[![Version](https://img.shields.io/cocoapods/v/KeyboardAvoider.svg?style=flat)](https://cocoapods.org/pods/KeyboardAvoider)\n[![License](https://img.shields.io/cocoapods/l/KeyboardAvoider.svg?style=flat)](https://cocoapods.org/pods/KeyboardAvoider)\n[![Platform](https://img.shields.io/cocoapods/p/KeyboardAvoider.svg?style=flat)](https://cocoapods.org/pods/KeyboardAvoider)\n\n# ⌨️ KeyboardAvoider {}\n\nA **KeyboardAvoider** for SwiftUI. Inspired by the simplicity of [keyboard_avoider](https://pub.dev/packages/keyboard_avoider) in [Flutter](https://flutter.dev/).\n\n## Features\n- Autoscroll to TextField\n- Swipe keyboard to dismiss\n\n\n## Installation\n\n### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\nCreate a `Package.swift` file.\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n  name: \"TestProject\",\n  dependencies: [\n    .package(url: \"https://github.com/michaelhenry/KeyboardAvoider.git\", from: \"1.0.0\")\n  ]\n)\n```\n\n### Cocoapods\n\n```ruby\ntarget 'MyApp' do\n  pod 'KeyboardAvoider', '~\u003e 1.0'\nend\n```\n\n## How to use\n\n```swift\nimport KeyboardAvoider\n\nKeyboardAvoider {\n  // ... Your view with TextFields\n}\n```\n\nExample:\n\n```swift\nKeyboardAvoider {\n    VStack {\n        TextField(\"First name\", text: self.$firstname)\n        TextField(\"Last name\", text: self.$lastname)\n        TextField(\"Email\", text: self.$email)\n        TextField(\"Password\", text: self.$password)\n        TextField(\"Confirm password\", text: self.$password)\n        Button(\"Sign Up\") {\n\n        }\n        Button(\"Already have an account?\") {\n\n        }\n    }\n    .padding(.horizontal, 16.0)\n}\n```\n\nOr in case you don't want to make your view scrollable, you can just only apply the `.avoidKeyboard()` into your main view.\n\n```swift\n    VStack {\n        TextField(\"First name\", text: self.$firstname)\n        TextField(\"Last name\", text: self.$lastname)\n        TextField(\"Email\", text: self.$email)\n        TextField(\"Password\", text: self.$password)\n        TextField(\"Confirm password\", text: self.$password)\n        Button(\"Sign Up\") {\n\n        }\n        Button(\"Already have an account?\") {\n\n        }\n    }\n    .avoidKeyboard()\n```\n\n## FAQ\n- How to remove the extra space between the textfield and the keyboard\n\n  \u003e You can remove it by ignoring the `safe area - bottom`. Please see the [Sample Project](https://github.com/michaelhenry/KeyboardAvoider/blob/d5293c541673bce47f00cdd0ec2f1b604b5341c8/KeyboardAvoider-Example/KeyboardAvoider-Example/ContentView.swift#L45)\n\n ```swift\n  .edgesIgnoringSafeArea(.bottom)\n  ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2FKeyboardAvoider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhenry%2FKeyboardAvoider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2FKeyboardAvoider/lists"}