Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. KeyboardObserver

KeyboardObserver

MITSwift2.1.0

A Swift library that simplifies iOS keyboard event handling by replacing NotificationCenter with a typed event-based API.

GitHubGitHub
161 stars17 forks0 contributors

What is KeyboardObserver?

KeyboardObserver is a Swift library that simplifies keyboard event handling in iOS applications. It replaces the traditional NotificationCenter approach with a clean, event-based API that automatically extracts keyboard properties like frame, duration, and animation curve from notifications. This eliminates the boilerplate code typically required for observing keyboard events and makes the implementation more maintainable.

Target Audience

iOS developers building applications that need to respond to keyboard show/hide events, particularly those working with text input interfaces who want cleaner code than NotificationCenter provides.

Value Proposition

Developers choose KeyboardObserver because it dramatically reduces the complexity of keyboard event handling, provides type safety, eliminates manual observer management, and makes code more readable compared to raw NotificationCenter usage.

Overview

For less complicated keyboard event handling.

Use Cases

Best For

  • Adjusting UI layout when keyboard appears/disappears
  • Creating smooth keyboard animations in iOS apps
  • Simplifying keyboard event handling in Swift projects
  • Reducing boilerplate code for keyboard observers
  • Building text-heavy interfaces with dynamic content adjustment
  • Replacing NotificationCenter-based keyboard handling with cleaner APIs

Not Ideal For

  • iOS applications built exclusively with SwiftUI, as KeyboardObserver relies on UIKit APIs and requires bridging
  • Projects already using reactive frameworks like RxSwift or Combine, where keyboard events can be integrated natively without an additional library
  • Teams seeking a drop-in solution with pre-built UI adjustments; KeyboardObserver only provides event data, not animation or layout logic

Pros & Cons

Pros

Eliminates Boilerplate Code

The README shows a direct comparison where KeyboardObserver replaces multiple lines of NotificationCenter setup with a single observe call, significantly reducing code complexity.

Type-Safe Event Handling

Uses structured types like KeyboardEvent and KeyboardEventType, making code less error-prone by avoiding manual parsing of notification dictionaries, as highlighted in the features.

Automatic Lifecycle Management

Observer instances automatically stop observing when deinitialized, preventing memory leaks without the need for manual removal, which is a key advantage over raw NotificationCenter.

Clean Event-Based API

Provides a closure-based approach that improves readability and maintainability compared to selector-based notification methods, as demonstrated in the usage example.

Cons

UIKit-Only Compatibility

Designed for UIKit, so integrating with SwiftUI requires additional bridging code, limiting its usefulness in modern iOS development where SwiftUI is prevalent.

No Built-in UI Logic

While it simplifies event handling, developers must still write custom animation and layout code to respond to keyboard events, as seen in the example where insets are manually adjusted.

Sparse Documentation

The README is brief and lacks detailed examples for edge cases or advanced scenarios, potentially forcing developers to rely on source code or trial and error.

Frequently Asked Questions

Quick Stats

Stars161
Forks17
Contributors0
Open Issues1
Last commit4 years ago
CreatedSince 2015

Tags

#ios#keyboard-handling#ui-kit#mobile-development#cocoapods#swift#event-handling#carthage

Built With

i
iOS
S
Swift

Included in

iOS51.7k
Auto-fetched 4 hours ago

Related Projects

IQKeyboardManagerIQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

Stars16,631
Forks2,444
Last commit1 month ago
TPKeyboardAvoidingTPKeyboardAvoiding

A drop-in universal solution for moving text fields out of the way of the keyboard in iOS

Stars5,793
Forks913
Last commit2 years ago
IHKeyboardAvoidingIHKeyboardAvoiding

IHKeyboardAvoiding is an elegant solution for keeping any UIView visible when the keyboard is being shown - no UIScrollView required!

Stars1,403
Forks155
Last commit3 years ago
TypistTypist

Swift UIKit keyboard manager for iOS apps.

Stars1,058
Forks47
Last commit5 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub