Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
atlouPublic archive

About

SwiftUI implementation of KeyboardAccessory. This resolves the keyboard interactive dismissal animation issue.

Topics

Resources

Stars

22 stars

Watchers

1 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

KeyboardAccessory

Problem

In SwiftUI, there is this bug where a bottom view will not follow the interactive dismissal of the keyboard.

Screenshot of the problem

Solution

Using this package, we can solve this problem and achieve the expected behavior.

Screenshot of the problem

Using the package

First, you need to add this package to your project dependencies. Then, you can import the package and use the .keyboardAccessory modifier on any type of scrolling view.

import SwiftUI
import KeyboardAccessory // Import the package

struct ContentView: View {
    var body: some View {
        VStack {
            ChatView()
                .keyboardAccessory {
                    InputView() // The view you want to use as an accessory
                }
                .scrollDismissesKeyboard(.interactively) // Dismiss the keyboard interactively
        }
    }
}

There is also a background closure that lets you add a background view.

ScrollView {}
    .keyboardAccessory {
        // Accessory
    } background {
        Rectangle()
            .fill(.regularMaterial)
    }

Credits

This package was built using BottomInputBarSwiftUI, which is used under the MIT license as per the user's permission. I only made some changes to the modifier and created a package. All credit for the actual implementation goes to frogcjn.

About

SwiftUI implementation of KeyboardAccessory. This resolves the keyboard interactive dismissal animation issue.

Topics

Resources

Stars

22 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages