AndrewBennet / ReadingListV1

:books: :iphone: Reading List - an iOS app to track personal reading lists
https://readinglist.app
GNU General Public License v3.0
300 stars 48 forks source link

When updating a book's progress, auto-select textfield's contents #44

Closed bryanjclark closed 4 years ago

bryanjclark commented 4 years ago

Hey there! Thanks for making such a fantastic app. It's been on my homescreen for a while, it's a delightful nudge to keep reading.

One small suggestion-nit is that it'd be faster to update the progress for a book if the textfield's contents are selected when the "Update" button is tapped. I'm often reading a book, and want to update the progress from, say, 32% to 48%, so it'd be faster if I could just type 48 instead of having to delete the contents and then type 48.

(I know this is a terribly-small nit! No worries if you don't want to merge it!)

Here's a GIF of it in action: select-textfield-contents-on-modal-presentation

bryanjclark commented 4 years ago

One thing that occurs to me is that I don't think we need to do if let on the textField here, as it's an implicitly unwrapped optional

I'd expected that to work, too, but I was seeing this in Xcode:

image

...but I'll assign it to a variable like you suggest!

AndrewBennet commented 4 years ago

Oh interesting! After a bit of Googling, I see now that since Swift 4.2, implicit optional-ness is only part of a variable declaration, so any variables assigned from an implicitly-unwrapped optional will have an optional type (https://swift.org/blog/iuo/#implicit-unwrapping-is-part-of-a-declaration).

This looks good, thanks for making the change 👍