ControlRoom icon indicating copy to clipboard operation
ControlRoom copied to clipboard

feat: extract subviews on extension

Open Harry-KNIGHT opened this issue 1 year ago โ€ข 5 comments

I found that settings view was really big, so I decided to extract them on method returning some View for a better readability.

If you have any feedback do not hesitate to reach me or comment the PR.

I think we can have a better naming for methods but I am not much inspired now

Harry-KNIGHT avatar May 06 '24 06:05 Harry-KNIGHT

This is a great idea! I'd be curious why these can't be pulled out to separate views entirely, rather than leaving them as methods.

twostraws avatar May 06 '24 07:05 twostraws

This is a great idea! I'd be curious why these can't be pulled out to separate views entirely, rather than leaving them as methods.

I have used methods that return views because what they do is quite explicit. This limits the number of files and previews to be added in addition to putting fewer lines to the file.

If it's better for the project, I can use structs to keep the homogeneity of the app

Harry-KNIGHT avatar May 06 '24 08:05 Harry-KNIGHT

Once we move over to @Observable (when macOS 15 is likely to be released around October), it's more efficient to create smaller views than one big one, even when methods are involved. So, let's plan ahead, just like we're moving towards Swift 6 already ๐Ÿ™‚

twostraws avatar May 06 '24 09:05 twostraws

Once we move over to @Observable (when macOS 15 is likely to be released around October), it's more efficient to create smaller views than one big one, even when methods are involved. So, let's plan ahead, just like we're moving towards Swift 6 already ๐Ÿ™‚

Yeah for sure we can take get ahead, the problem with my extension of the view is the coupling of subview with the main view, I think it's better to use separate view entirely.

I'll make the changes soon ๐Ÿ”œ

Harry-KNIGHT avatar May 06 '24 18:05 Harry-KNIGHT

This works as expected, if you see some improvements do not hesitate to told me @twostraws

https://github.com/twostraws/ControlRoom/assets/63256761/560978ef-870f-4b68-be89-d1c86aa2e7ae

Harry-KNIGHT avatar May 11 '24 07:05 Harry-KNIGHT

This is perfect โ€“ย thank you!

twostraws avatar May 13 '24 10:05 twostraws