Details: App Switcher + Keyboard Input Accessory Views

Arthur Van Siclen
Minimal | Notes
Published in
2 min readJan 11, 2023

Sometime during iOS 15 or iOS 16, the visibility of the iOS keyboard stopped controlling the visibility of input accessory views. The effect is out-of-place, floating elements visible while switching between apps. (See Figure 1.)

Figure 1. App Switcher. The left image shows the floating keyboard accessory view that normally sits above the iOS keyboard, the middle image highlights the offending floating element, and the right image displays the correct behavior.

The fix is easy: listening to scene lifecycle changes. Specifically, we’re intereseted in UISceneDidEnterBackgroundNotification and UISceneWillEnterForegroundNotification. (Apple’s documentation here.)

Objective-C:

- (void)listenForSceneLifecycleChanges {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(hideKeyboardForSceneLifecycle)
name:UISceneDidEnterBackgroundNotification
object:NULL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(showKeyboardForSceneLifecycle)
name:UISceneWillEnterForegroundNotification
object:NULL];
}
- (void)hideKeyboardForSceneLifecycle {
self.formattingKeyboard.hidden = YES;
}
- (void)showKeyboardForSceneLifecycle {
self.formattingKeyboard.hidden = NO;
}

Swift:

func listenForSceneLifecycleChanges() {
NotificationCenter.default.addObserver(self, selector: #selector(hideKeyboardForSceneLifecycle), name: UIScene.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showKeyboardForSceneLifecycle), name: UIScene.willEnterForegroundNotification, object: nil)
}

func hideKeyboardForSceneLifecycle() {
formattingKeyboard.isHidden = true
}

func showKeyboardForSceneLifecycle() {
formattingKeyboard.isHidden = false
}

For tools we use every day, the details matter. Each interaction adds up. Small, joyous moments turn into an overall feeling of joy when we next encounter the tool. Flaws have a similar effect, negating the beautiful details (at best) or introducing friction (at worst).

For Minimal, this type of attention to detail pushes the app into the category of delightful tools. There’s a reason Minimal is loved by so many writers (despite seeing a fraction of the downloads we see with other, higher-volume-by-download apps), and I’m confident that getting the small, boring, everyday details right plays a significant role in improving customer retention and boosting writer delight.

--

--