2

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

Benj
  • 736
  • 7
  • 21
Divye Shah
  • 747
  • 1
  • 11
  • 24

2 Answers2

4

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)

Benj
  • 736
  • 7
  • 21
3

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)

Infinity James
  • 4,667
  • 5
  • 23
  • 36
  • I tried [link name](@next) But when i run it in assistant editor I don't see the link. Also should I place that in viewDidLoad() method of the class? or in playground page where I instantiate the class. Also when I add [link name](@next) it cannot locate the @next file when i try to open by clicking + cmd button – Divye Shah Mar 31 '18 at 08:42