You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 1.22.x I want to re-write the algorithm for tracking keyboard (yes, again) and switch back to legacy path (it looks like I found a better way of managing things and I can deliver better experience than KeyboardLayoutGuide).
But at the same time I don't want to drop the current code with KeyboardLayoutGuide. So I decided to hide it under feature flag. If users discover regressions - they can just toggle feature flag and restore old behavior.
Also in future if my method stops to work again I can also toggle feature flag and use modern path (when KeyboardLayoutGuide will be stable).
To achieve this I added KeyboardControllerConfiguration with usesKeyboardLayoutGuideTracking field. And repalced corresponding #available(iOS 26.0, *) condition to usesKeyboardLayoutGuideTracking field. Such code helps us:
reduce code fragmentation;
control things from one place;
simplify the codebase and maintenance in the future.
While refactoring it I also realised that we don't need to attach invisible KeyboardLayoutGuide on older iOS versions so I also guarded this code with usesKeyboardLayoutGuideTracking flag.
📢 Changelog
iOS
added KeyboardControllerConfiguration file;
guard KeyboardLayoutGuide code under usesKeyboardLayoutGuideTracking flag;
🤔 How Has This Been Tested?
Tested via e2e test.
📸 Screenshots (if appropriate):
📝 Checklist
CI successfully passed
I added new mocks and corresponding unit-tests if library API was changed
Guard Statement in attachToTopmostView Prevents Attachment on Older iOS Why: The guard statement in attachToTopmostView returns early if usesKeyboardLayoutGuideTracking is false, which skips attaching the view on older iOS versions where it's needed. Fix: Remove the guard statement to ensure attachment happens across all supported iOS versions.
Incorrect View Type Determination Based on Configuration Why: The view property uses the configuration to choose between self and keyboardView, risking incorrect selection if the configuration is misused or has bugs. Fix: Replace the condition with a direct check for iOS version 26 or higher using #available(iOS 26.0, *).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🍎 iOSiOS specificrefactorYou changed the code but it didn't affect functionality
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Make configuration for
KeyboardTrackingView.💡 Motivation and Context
In
1.22.xI want to re-write the algorithm for tracking keyboard (yes, again) and switch back to legacy path (it looks like I found a better way of managing things and I can deliver better experience thanKeyboardLayoutGuide).But at the same time I don't want to drop the current code with
KeyboardLayoutGuide. So I decided to hide it under feature flag. If users discover regressions - they can just toggle feature flag and restore old behavior.Also in future if my method stops to work again I can also toggle feature flag and use modern path (when
KeyboardLayoutGuidewill be stable).To achieve this I added
KeyboardControllerConfigurationwithusesKeyboardLayoutGuideTrackingfield. And repalced corresponding#available(iOS 26.0, *)condition tousesKeyboardLayoutGuideTrackingfield. Such code helps us:While refactoring it I also realised that we don't need to attach invisible
KeyboardLayoutGuideon older iOS versions so I also guarded this code withusesKeyboardLayoutGuideTrackingflag.📢 Changelog
iOS
KeyboardControllerConfigurationfile;KeyboardLayoutGuidecode underusesKeyboardLayoutGuideTrackingflag;🤔 How Has This Been Tested?
Tested via e2e test.
📸 Screenshots (if appropriate):
📝 Checklist