The playground has its own XCPlayground
framework, which can be used to perform certain tasks. For example, individual values can be captured during loops for later analysis. It also permits asynchronous code to continue to execute once the playground has finished running.
It is possible to explicitly add values to the timeline by importing the XCPlayground
framework and using XCPlaygroundPage.currentPage
, and calling captureValue
with a value that should be displayed in the timeline. This takes an identifier, which is used both as the title and to group related data values in the same series. When the value history button is selected, it essentially inserts a call to captureValue
with the value of the expression as the identifier.
For example, to add the logo to the timeline automatically:
import XCPlayground let page = XCPlaygroundPage.currentPage let alblue = UIImage(named:"alblue") page.captureValue(alblue, withIdentifier:"Al Blue")