I am doing the SwiftUI tutorial which is on the Apple's website in Xcode 11 playground because I use Mojave and not Catalina. There is an image called turtlerock.jpg, but it doesn't show in the playground.
I put the image inside the resource folder, but no luck.
1. How To Create Playground Project Use Xcode. When you start Xcode, there are three project templates that you can choose to create, click the first item Get started with a playground to create a playground project.
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.
To show it in its rendered form, select the button in the top right corner of the window, which shows Xcode's Inspector. Then select Render Documentation under Playground Settings. The lines in my poem are now rendered. Other interesting things you can do with the markup are adding headings to a Playground peach.
Playground Description is of type Any, which means you can return anything that you feel best describes your value. Now, there are certain types that have specialized representations already and those are provided by Apple.
I've been scratching my head over this problem too. I've managed to find at least a workaround for now:
Instead of:
Image("turtlerock")
try:
Image(uiImage: UIImage(named: "turtlerock.jpg")!)
You'll have to have turtlerock.jpg in the Resources folder of your playground. If you turn it into a .png first, you can use UIImage(named: "turtlerock")
in the above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With