twostraws / ControlRoom

A macOS app to control the Xcode Simulator.
MIT License
5.71k stars 306 forks source link

feat: turn methods private and fix text moving depending on number te… #178

Closed Harry-KNIGHT closed 7 months ago

Harry-KNIGHT commented 7 months ago

When using the slider for device battery, I saw a common problem: all the text around was moving when the number is changing.

So, for fix this, I added a font modifier with monospacedDigit() in the [Apple's documentation](https://developer.apple.com/documentation/swiftui/view/monospaceddigit()) it is saying: Returns: A font that uses fixed-width numeric characters.

Before the patch

https://github.com/twostraws/ControlRoom/assets/63256761/5dca488c-e8ed-4f18-b4d2-fff207003226

After the patch

https://github.com/twostraws/ControlRoom/assets/63256761/a16e89c3-2839-4a2c-9d08-c53bb5104a7d

All text is only moving when the slider value goes from 9 to 10 and 99 to 100.

I thought to add animation as the one on the Apple Watch but it is too much for a developer software.

Access control

I declared method on the view as private for being more comprehensive by the compilator and maybe win some milliseconds at build time.

If you see something to improve let me know about it.

Harry-KNIGHT commented 7 months ago

@twostraws what's the convention about indentation ? I think I made something wrong on this MR so much code where touched by indentation after cmd + a cmd + i

image

I Changed indent using Spaces it fixed it.

twostraws commented 7 months ago

Thank you! Regarding spacing etc, ideally the issue should be flagged up by SwiftLint, but if it isn't we should look to add a rule.