Create a playground in Xcode 13 and newer versions
In the newer versions of Xcode, some of us could not find the create playground option. Here I will show you how to create playground easily in Xcode step by step.
We can assume that you have already installed the XCode on your machine.
Create a new Playground in Xcode
The first window will be like this:
In the earlier versions in the first option, we would see the “Create a new Playground” option.
But here we need to put a small extra effort to get that option.
First, click on File as shown in the below image.
After clicking on File you will have to hover your cursor on New and then simply click on Playground.
Now you will get a screen like the below image.
At this step, you can choose iOS or macOS.
Here I have selected iOS and a blank Playground and then click on Next.
In the next step, you will have to write your Playground name and choose the location where you want to save your Playground project or files. You can put any name that you would like.
If everything is alright then you may expect a screen like this.
At the top of the screen you can see a message: Build Succeeded
Run Xcode Playground project – Swift
To run your program just click on the play button. (The button is just below the last line of your code)
You can change the string to test if everything is working fine.
Check how the output looks like.
In some cases, it has been seen that the Build message is showing: Running for a long time.
What to do if you get a Running message for a long time in Xcode playground
- Close the application and reopen.
- Change anything in the string and then click on the run button.
For me, this method worked well.
Leave a Reply