You can hide code that is not related to the main content of a playground page, such as calls to page setup functions, code for assessing the progress of the learner, and functions used in editable examples. Hidden code is executed when the playground is run and all of the public symbols are accessible on the playground page.
line of code
Hidden code is placed between the
end-hidden-code delimiters. The opening and closing delimiters are preceded by two forward slash characters followed by a pound sign and a hyphen (
//#-) and appear on a separate line.
You can place hidden code at the top and bottom of a playground page. Additionally, on pages with at least one editable area, you can place hidden code anywhere on the page outside of an editable area.
PlaygroundSupport, even though the
import statements are hidden.
Change properties of `theView` and run the playground.
* `CGColor`: `markColor` and `backgroundColor`
* `Bool`: `isChecked`
* `CGFloat`: `strokeFactor`, `insetFactor`, and `markInsetFactor`
let viewRect = CGRect(x: 0, y: 0, width: 100 , height: 400)
let theView = CustomView(frame: viewRect)
PlaygroundPage.current.liveView = theView
theView.markColor = UIColor.darkGray
theView.isChecked = true
theView is used to change properties of the live view, even though it is defined in the hidden code.