Divye Shah
Divye Shah

Reputation: 767

Linking pages in Swift Playgrounds [Xcode]

I am new to swift playgrounds and ran into some problems while making a swift playground in Xcode.

This is my main Playground page

import UIKit
import PlaygroundSupport
import SpriteKit
let secondScene = Index()
let master = FirstScene()
let root = UINavigationController(rootViewController: master)
PlaygroundPage.current.liveView = root

But when I tried adding Next Topic in both the source class in Swift and the playground page itself the link does not appear.

NOTE: I am using Swift Playgrounds in Xcode not a Playgroundbook on an iPad.

Also, inside sources folder of my main page I declared all classes as public, is that the right way to use the helper swift files in source?

I tried creating a new playground and added pages which have default links but still no output.
New playground but assistant editor shows no links

Upvotes: 2

Views: 2957

Answers (2)

Benj
Benj

Reputation: 794

Looking at your screenshot, you've got the code right. The syntax to link to the next page is [Next Page!](@next). All you need to do now is:
- In the Xcode menu bar, click Editor
- Click 'Show Rendered Markup'

Editor -> 'Show Rendered Markup' Menu

That's it. You can place markup wherever you like. Remember to replace spaces with %20 when linking to a playground page, e.g. [My Page #2](My%20Other%20Page)

Upvotes: 4

Infinity James
Infinity James

Reputation: 4735

You would benefit from reading Apple's Markup Formatting Reference.

To create a link to another page you will do the same thing that I did above to create a link to that reference in Markdown:

[Next Topic](Pretend%20Topic%20Name)

You can actually do something like this as well:

[Next Topic](@next)

Upvotes: 3

Related Questions