UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Organizing Large Views

Forums > SwiftUI

I'm curious if there are any tools (like xcode extensions) or techniques to better organize views. I'm on project 2 of the 100 Days of SwiftUI so it's entirely possible I'm asking a question that gets answered later.

The problem I'm having is that I find is that it is very anoying to have to select a bracket to know which starting position it is attached to. When it comes to long documents it is extra annoying because the starting bracket can be so far away that it can't even be seen getting highlighted.

In my other programming enviornments I would use some kind of Rainbow Bracket style coloring extension to make it easier to manage things, but that doesn't seem to be an option for xcode.

1      

Break views into subviews. SwiftUI is designed to be composable so take advantage of it.

1      

As @roosterboy say break them up in to smaller subview. You can also double click on a brace and will highlight the whole code between the braces or you can fold the code with option + cmd + <- and unfold with option + cmd + ->

2      

All the above, plus there are changes coming in Xcode 14.

Not sure if this will be user switchable (I hope so, as sometimes you might want to turn it off), and if it will be also in view, not just init, structs, func etc.

Video Xcode 14 Edit Scrolling { } Sticky - see around 9:35

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.