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

Xcode14 how to open two different playground files within the same window?

Forums > 100 Days of SwiftUI

Hi, I newly installed the latest Xcode 14.3.1, and am encountering a navigational problem.

There are two different playground files I want to have open. After I open the 1st file, a new Xcode window opens to show the file. When I hit cmd+o to open the 2nd file, a new 2nd window opens to show the 2nd file. But I don't want two different windows, I want just one window with two tabs. That seems impossible?

I have tried Google search, and different navigational settings, as well as menu options. Nothing seems to work. When I read the Xcode documentation, I can't quite find as a definitive simple answer as to whether I can, or can not, open two files in the same window.

What am I missing? Please help. Thank you.

   

Seems a little odd as to why you would want to do this? Is there anything specific the playground does that an Xcode project can't do? Playground, well for me anyway seemed a little basic and maybe a little limited on what it can do. Well I say that, but I'm sure there are workarounds for preview and all that. Here's what you could do...Create a project in Xcode and add two swift files and name the files PlaygroundOne and PlaygroundTwo? And then add a button / nav link to switch between the two..... I added a file to my project a while back called MyPlayground. And so I don't have to switch out of my project.

   

Thank you so much George.

I have started the 100Days SwiftUI program. And that program starts working with the fundamentals in playground files, which is why I am creating playground files.

From what you are saying, I gather what you mean is Xcode can not have two files from two different projects to open within the same window? So the suggestion you made is to create two files in the same project, so they are both available to open in the same window within the project navigation area. Okay, I just tried. I guess that is a workaround.

What's important is clear from this that the Xcode editor can't open two files from two different projects in the same window, and those two files from the same project can't be playground files. I guess if that is the Editor's constraint and requirement, it's good to simply know for sure and not wondering.

Thanks once again! Nicole

   

Ohhh I see why you would want that. It's not a bad idea I guess. Paul uses the playground for the basics for about 14 days then the rest of the 86 days is on the Xcode projects. So don't worry you'll have multiple files and tabs coming out of your ears in no time. Just follow his tips/advice you'll do well.

George

1      

I'm also using Xcode a playground to create notes and practice writing code while reviewing the first 15 days of 100 Days. What I've been doing is creating individual playground pages for each day/checkpoint.

If you have the left-hand Navigator panel open and are displaying the Project Navigator for your playground, right-click the name of the playground and choose 'New Playground Page' from the pop-up menu.

   

Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

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.