Holy Swift

Holy Swift

Permanent and Temporary Tabs in Xcode

Permanent and Temporary Tabs in Xcode

Xcode features

Subscribe to my newsletter and never miss my upcoming articles

Hallo vrienden, Leo here.

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 coming in the next weeks.

Let's go!

The Painting

The painting I choose was a 1926 named Boy and Girl gazing at the Moon from 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 of 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 represent children represent the both types of tabs in Xcode. Two tab types, two children in the painting. :)

The Problem

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:

Screen Shot 2021-05-19 at 08.22.25.png

And you single click in ViewController.swift:

Screen Shot 2021-05-19 at 08.23.15.png

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

The Xcode have 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 open a new tab or replace the current temporary tab with the new file.

The temporary tab represent 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 you Xcode with thousand open tabs and organizes 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 open in a temporary tab and if you single-click again in another file in the Project Navigator the other file will replace the actual.

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's a 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 in 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 a temporary again.

Conclusion

This week 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 open in another tab or not.

That's all my people, I hope you liked this as I liked writing. If you want to support this blog you can Buy Me a Coffee or just leave a comment saying hello.

Thanks for the reading and... That's all folks.

credits: image

Interested in reading more such articles from Leonardo Maia Pugliese?

Support the author by donating an amount of your choice.

#swift#xcode#apple#ios
 
Share this