Commit af6d19d
authored
refactor: split
## 📜 Description
Split `KeyboardMovementObserver` implementation into several files.
## 💡 Motivation and Context
The main issue is that whenever I add new lines of the code into the
file I instantly get complaints from `swiftlint` that I exceed max
allowed number of lines. I don't want to disable this rule, because I
strongly agree that fields with 300+ lines of code are hard to
read/memoize in your head.
In fact `KeyboardMovementObserver` implementation consist from 4
different (but toughly related parts):
- KVO (interactive keyboard);
- DisplayLink (to watch keyboard movement during animation)
- lifecycles methods (mount/unmount)
- listeners (subscription to keyboard events)
- animation (initialize animation driver to deliver better
synchronization when reading keyboard coordinates via `DisplayLink`)
And such structured stuff very easily can be splitted across different
files. For that I used `extension` approach and grouped logically all
parts into groups.
Now the structure of this file is more molecular and extendable, so
it'll simplify support in the future 😎
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### iOS
- created `KeyboardMovementObserver+Listeners.swift` file
- created `KeyboardMovementObserver+Watcher.swift` file;
- created `KeyboardMovementObserver+Interactive.swift` file;
- created `KeyboardMovementObserver+Lifecycles.swift` file;
- created `KeyboardMovementObserver+Animation.swift` file;
## 🤔 How Has This Been Tested?
Tested via CI.
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changedKeyboardMovementObserver implementation (#1071)1 parent b6e3594 commit af6d19d
10 files changed
Lines changed: 347 additions & 306 deletions
File tree
- ios/observers
- movement
- observer
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments