BLACK FRIDAY SALE: Save big on all my Swift books and bundles! >>

Is there a way to unembed code?

Forums > SwiftUI

@Apps  

Suppose this code:

ScrollView {
      Section() {
        Text("Header")
          .font(.largeTitle)
      }
      ForEach(numbers, id: \.self) {
        Text("\($0)")
      }
    } // 1

Now suppose I want to remove the ScrollView, so this will be a 3 step operation:

  1. Double click the opening curluy brace at the ScrollView line to see where is the ending curly brace.
  2. comment the ScrollView line
  3. comment the curly brace at //1

Is there any shortcut or something that allows this to be done with one operation? I mean comment both lines but not the lines inside?

   

Hacking with Swift is sponsored by RevenueCat

SPONSORED In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.

Learn more

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

Reply to this topic…

You need to create an account or log in to reply.

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.