Swiftpack.co -  afiorito/MagicKeyboard as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A library for seamlessly managing the position of UITextField/UITextView during iOS keyboard appearance.
.package(url: "https://github.com/afiorito/MagicKeyboard.git", from: "v1.0.2")

icon MagicKeyboard

MagicKeyboard is a library for seamlessly managing the position of text inputs during iOS keyboard appearance. It automatically positions UITextField/UITextViews so they are visible when the keyboard appears. No Code Required!


Add MagicKeyboard to your project using Swift Package Manager. In your Xcode project, select File > Swift Packages > Add Package Dependency and enter the repository URL.

Basic Usage

MagicKeyboard is a codeless solution to positioning input views when the keyboard appears. All you need to do is instantiate an instance of MagicKeyboard that will live for the lifetime of the application.

class AppDelegate: UIResponder, UIApplicationDelegate {
    let magicKeyboard = MagicKeyboard()


That is all that's needed! MagicKeyboard will handle positioning input views inside a regular UIView or UIScrollView when the keyboard appears.


MagicKeyboard is available under the MIT license. See the LICENSE file for more info.


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

MagicKeyboard v1.0.2
48 weeks ago

Add resignsFirstResponderOnTapOutside property to MagicKeyboard

This new property allows setting the behavior of resigning the keyboard when tapping outside the responding text input.

public var resignsFirstResponderOnTapOutside: ResignBehaviour = .always

The behavior is set using the ResignBehavior enum:

public enum ResignBehaviour {
    /// Always resign when tapping outside the responding text input.
    case always
    /// Resign when the view tapped outside the responding text input is not a subclass of `UIControl`.
    case ignoreControls
    /// Never resign when tapping outside the responding text input.
    case never

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API