Linking pages in Swift Playgrounds [Xcode]

孤者浪人 提交于 2019-12-11 01:53:58

问题


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.


回答1:


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)




回答2:


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'

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)



来源:https://stackoverflow.com/questions/49584922/linking-pages-in-swift-playgrounds-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!