1

I would like to graphically reduce a View or a VStack like I saw in a video. The guy selects the VStack and by pressing on his keyboard he gets a thumbnail of his VStack. I have this :

VStack {
    TextField("Placeholder", text: $newValue)
        .background(Color.white)
    Button(action: {}) {
        Text("Button")
    }
}.padding()

and I'd like to have to this:

VStack{...}.padding()

What are the keyboard keys to enter?

Rohit Makwana
  • 4,337
  • 1
  • 21
  • 29
MxM
  • 199
  • 1
  • 3
  • 12
  • Can you provide a link to the video and the timestamp showing the behaviour you saw, so that we know what you are talking about? – Sweeper Apr 22 '20 at 10:15
  • Does [this](https://stackoverflow.com/questions/40285997/xcode-swift-code-folding-collapse) answer your question? – Sweeper Apr 22 '20 at 10:18
  • 1
    Does this answer your question? [Xcode Swift code folding/collapse](https://stackoverflow.com/questions/40285997/xcode-swift-code-folding-collapse) – Ishmeet Apr 22 '20 at 10:21

3 Answers3

2

What you describe is called "Code Folding" and can be accessed in multiple ways:

  • (Menu) Editor > Code Folding > Fold enter image description here
  • By clicking the left ribbon of the scope you want to fold enter image description here
  • By using the shortcut ⌥ ⌘ ← (or the variant most suitable for the case)
Alladinian
  • 34,483
  • 6
  • 89
  • 91
1

It's called Code Folding. Can be done by pressing the following keys together.

Opt + Cmd + Left Arrow Key (⌥ + ⌘ + ⇠) after the opening brace of your VStack

More shortcuts here: https://swifteducation.github.io/assets/pdfs/XcodeKeyboardShortcuts.pdf

Ishmeet
  • 707
  • 6
  • 18
1

Ctrl + Alt + Cmd + ← (arrow left)| collapse method

Ctrl + Alt + Cmd + → (arrow right) | expand metnod