Hallo vrienden, Leo here. This week’s topic is Permanent and Temporary Tabs in Xcode.

This week my friend Tales teach me about one Xcode feature that bugged my head for a long time. Did you notice that sometimes you open a new file in a new tab and sometimes you open new files replacing the tab you are working on? Yes, this feature is the permanent and temporary Tabs and that’s what we will talk about today. No code for today but don’t worry, more coding will come in the next weeks.

Let’s go!

 

Painting of The Day

The painting I chose was 1926 named Boy and Girl gazing at the Moon by Norman Rockwell. Norman Perceval Rockwell was a 20th-century American author, painter, and illustrator. His work is loved by Americans for its reflection of American culture, making him one of the most famous artists in the USA. Looking at Rockwell’s love for provincial life, one could imagine he was born and raised on a farm. But in fact, he was born in New York City, and raised in a popular neighborhood, experiencing all the violence of city gangs.

I choose it because children represent both types of tabs in Xcode. Two tab types, two children in the painting.

 

The Problem – Permanent and Temporary Tabs in Xcode

You are reading a tab X and want to open another file but that file replaces the tab X.

Imagine that you have this file structure:

Permanent and Temporary Tabs in Xcode file structure tutorial

And you single click in ViewController.swift:

Permanent and Temporary Tabs in Xcode open file tutorial

Did you notice that the ViewController.swift name in the tab bar is italic? But why is that?

The Xcode has this feature called permanent and temporary tabs.

This means that every open tab is in one state or another. When a tab is in italic means that’s is a temporary tab and when isn’t it’s a permanent/regular tab. Every time you open a new file (with shortcuts like shift+cmmd+O or in the Project Navigator) the Xcode will choose between opening a new tab or replacing the current temporary tab with the new file.

The temporary tab represents something that can be discarded, so if you try to open another tab it will replace the temporary tab. This is good to not flood your Xcode with thousand of open tabs and organize the dev workbench.

To open a file as a temporary tab you just need to single-click in the Project Navigator, like the image above. Your file opens in a temporary tab and if you single-click again on another file in the Project Navigator the other file will replace the actual one.

The permanent tabs as the name say are permanent. They won’t be replaced by new ones if you try to open any other file. There are several ways to turn a temporary tab into a permanent one, let’s see:

  1. Double-click on the file in the Project Navigator when the file is not open.
  2. You can also double-click on the Project Navigator in an already open file to make it permanent.
  3. Double-click on the tab itself.
  4. Right-click on the tab and select “Keep Open”.
  5. Edit/Write something in the file of the temporary tab will turn it into a permanent tab.

 

One curiosity is that you can have only one temporary tab open and from the moment the tab is permanent it will never become temporary again.

 

Summary – Permanent and Temporary Tabs in Xcode

This week’s post was a feature about Xcode and workbench cleanliness and I hope you like it. I found it very interesting and now I know why sometimes the file opens in another tab or not.

That’s all my people, I hope you liked reading this article as much as I enjoyed writing it. If you want to support this blog you can Buy Me a Coffee or leave a comment saying hello. You can also sponsor posts and I’m open to freelance writing! You can reach me on LinkedIn or Twitter and send me an e-mail through the contact page.

Thanks for reading and… That’s all folks.

Credits: image