Animations not working in ios playground

荒凉一梦 提交于 2019-12-01 06:25:52

Xcode 7, Swift 2

Add

import XCPlayground

at the top of the Playground, then use

XCPlaygroundPage.currentPage.liveView = view

at the bottom of the Playground, where view is the view you want to render.

You also have to open the "Assistant Editor" (in the "View" menu) to see the current live view.

Also, if you're using asynchronous operations, you have to include

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

in order to use them in a Playground.

Xcode 8, Swift 3

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