SafeAreaInputAccessoryViewWrapperView 1.0.1

SafeAreaInputAccessoryViewWrapperView 1.0.1

Maintained by Jeff Burt.

SafeAreaInputAccessoryViewWrapperView Logo

Swift4.0 Platform Version License


SafeAreaInputAccessoryViewWrapperView is useful for wrapping a view to be used as an inputAccessoryView. Without this, setting the view as an inputAccessoryView will ignore safe area layouts. For example, the Home screen indicator on iPhone X will battle for the same spot. This class ensures that the view respects safe area layouts and does not cover up system UI elements such as the Home screen indicator on iPhone X.

Works with iOS 9.0+ and Xcode 9.0.0+.


  1. Features
  2. Usage
  3. Installation
  4. License
  5. Contact


  • Works with all devices running iOS 9+.
  • Respects safeAreaLayoutGuide on devices running iOS 11+. For example, the wrapped view is slid up to make room for the iPhone X Home screen indicator.
  • Dynamically sets the wrapped view's height using autolayout constraints. No more setting frames manually!
  • Example app with an inputAccessoryView that's always visible, even when the keyboard is closed.

Example Project Screenshot - iPhone X Example Project Screenshot - iPhone 8


  1. Wrap any UIView/UIButton/UILabel/etc using SafeAreaInputAccessoryViewWrapperView(for:):
SafeAreaInputAccessoryViewWrapperView(for: button)
  1. Store a reference to this somewhere in your class:
let button = UIButton(type: .system)

lazy var wrappedButton: SafeAreaInputAccessoryViewWrapperView = {
    return SafeAreaInputAccessoryViewWrapperView(for: button)
  1. Return the reference in inputAccessoryView:
override var inputAccessoryView: UIView? {
    return wrappedButton
  1. (Optional) Always show the inputAccessoryView, even when the keyboard is closed:
override var canBecomeFirstResponder: Bool {
    return true

override func viewDidLoad() {



CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate SafeAreaInputAccessoryViewWrapperView into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'SafeAreaInputAccessoryViewWrapperView'

Then, run the following command:

$ pod install

In case Xcode complains ("Cannot load underlying module for SafeAreaInputAccessoryViewWrapperView") go to Product and choose Clean (or simply press K).


If you prefer not to use CocoaPods, you can integrate SafeAreaInputAccessoryViewWrapperView into your project manually.


SafeAreaInputAccessoryViewWrapperView is developed by Jeff Burt at StockX and is released under the MIT license. See the LICENSE file for details.


Feel free to follow me on my personal Twitter account. If you find any problems with the project or have ideas to enhance it, feel free to open a GitHub issue and/or create a pull request.