Skip to main content

Overview

The Appearance subspec allows you to override the keyboard appearance globally or per-view, making it easy to maintain a consistent look across your app.

Installation

The Appearance subspec is included by default when you install IQKeyboardManagerSwift:
Podfile

Configuration Object

Appearance settings are managed through the IQKeyboardAppearanceConfiguration object:
AppDelegate.swift

Global Appearance Override

Set a consistent keyboard appearance for all text fields in your app:
AppDelegate.swift

Appearance Options

The keyboard supports three appearance modes:
UIKeyboardAppearance
Uses the system default appearance (light on iOS)
UIKeyboardAppearance
Light keyboard with dark text
UIKeyboardAppearance
Dark keyboard with light text

Examples

Force Dark Keyboard

AppDelegate.swift

Force Light Keyboard

AppDelegate.swift

Use System Default

AppDelegate.swift

Per-View Appearance

While the global configuration affects all text fields, individual text fields can still set their own keyboard appearance when override is disabled:
ViewController.swift
Per-view keyboard appearance settings are ignored when overrideAppearance is true.

Dynamic Appearance Changes

You can change the keyboard appearance at runtime:
ViewController.swift

Dark Mode Support

To automatically match system dark mode:
AppDelegate.swift

Respond to Dark Mode Changes

ViewController.swift

Complete Example

Here’s a complete example with theme switching:
ThemeManager.swift
SettingsViewController.swift

Configuration Properties

Bool
default:"false"
When true, applies the configured appearance to all text input views, ignoring individual keyboardAppearance settings.
UIKeyboardAppearance
default:".default"
The keyboard appearance to use when overrideAppearance is true. Options: .default, .light, .dark.

When Override is Disabled

When overrideAppearance is false:
  • Each text field uses its own keyboardAppearance property
  • UITextField and UITextView default to .default
  • You can set different appearances for different fields
  • System respects individual field settings
ViewController.swift

Best Practices

Set the keyboard appearance to match your app’s overall theme for a cohesive user experience.
Some users may find dark keyboards easier to read in low-light conditions, while others prefer light keyboards.
Always test your forms with both light and dark keyboard appearances to ensure text visibility.
Call reloadInputViews() on active text fields after changing appearance settings to see changes immediately.

Troubleshooting

  • Verify overrideAppearance is set to true
  • Call reloadInputViews() on the active text field
  • Check if a custom inputView is overriding the keyboard
This is expected when overrideAppearance is true. Set it to false to respect individual field settings.
Implement traitCollectionDidChange(_:) in your view controller to respond to system appearance changes.

Next Steps

Advanced Configuration

Customize keyboard distance and behavior

Toolbar Management

Add Previous/Next/Done buttons

Resign Keyboard

Dismiss keyboard on tap outside

API Reference

Full appearance API documentation