Closed dylman123 closed 4 years ago
Currently there is an issue with how the TextField view and the List selector interact. When text is typed into the TextField, often the TextField is exited unintentionally (bug).
Bugs that currently exist in edit view:
Me thinks some (if not all) of the above are memory related issues. Using the Leaks instrument, I detected 50+ leaks. App is using 40-60MB of memory on a simple view. This doesn't seem right. Need to work out what is causing the leaks.
The following vids may help:
Maybe there is a bug using List in SwiftUI? https://stackoverflow.com/questions/58965282/problems-with-layout-of-some-rows-in-swiftui-list
Maybe there is an issue with how I am passing @State or @EnvironmentObject throughout views? https://forums.developer.apple.com/thread/126890
My latest thinking is that maybe all the functions should be decoupled from the UserData class. Maybe the UI should call the generateCaptions() function directly, and this shouldn’t sit inside UserData.
What might be happening is some sort of interference between the execution of these functions and the UserData class which updates the UI (by “publishing”) whenever a change is sensed.
Although this tutorial seems like I’m on the right track! https://youtu.be/1IlUBHvgY8Q
Swapping List for ScrollView fixed a lot of the bugs! There are still some memory & CPU issues when the list gets long.
Learn how to use NSEvents such as capturing key and mouse events:
Look at 30:00 for keyboard events: https://www.youtube.com/watch?v=FE4ys3tW1VI
Use this reference to add more keyCodes: https://eastmanreference.com/complete-list-of-applescript-key-codes
There is a bug that occurs: A double delete when deleting caption at index 0. Selected caption goes to -1 position.
Next elements to build:
Fixed bug where double delete was occurring at index 0!
Need ScrollView to scroll when selected caption reaches end of visible list.
I can get the list to scroll, but the UI doesn’t refresh instantly. It seems to refresh only when certain variables are updated.
Solved state sync and UI bugs!
~1. Tagging system to quickly assign font settings to each caption with a keyboard press~
Look at using TextField / TextEditor (Swift 5.3) in combination with keyboard shortcuts - will need a refactor...
~Merge edit & pause states?~ ~This would mean that 'edit' state is when the TextField is active.~
Will not work on this, I am happy with the decoupling of pause and edit states for now.
UX improvements to make the Edit screen easier to use:
There should be 4 modes within the Edit view: a) Start, b) Playback, c) Select, and d) Edit mode.
In Start mode (similar to Select mode but where no caption is selected):
In Playback mode:
In Select mode:
In Edit mode:
General: