When i started working with Swift, I had a very bad experience working with standalone Playground file.
As per apple documentation, I created my first Swift application file with
File -> New ->Playground.
When i added few lines of code, Swift compiler immediately started compiling each line. In result of this compilation, Xcode application went for waiting state and then it hanged. I had to restart my Xcode with “forced close”. I had the same issue again when i wrote few more lines. If you would have the same issue, Follow this solution,
1. Create an Empty Project with File -> New -> Project
2. In new window Select iOS -> Other -> Empty and press Next
3. Assign good name to your project (product), Press Next and select a place where you want to save your project.
Once everything is done you will see follwing picture of your project.
4. Right click on your project and select New File…
5. Select iOS -> Source -> Playground
6. Assign good name to your file and press save. Make sure Where and Group is your newly created project.
Here you can add all your Playground files in this project and Xcode would not create any problem.