Xcode 8.3.2游乐场实时视图渲染不起作用

Ale*_*y K 2 xcode ios swift swift-playground

此代码在以前版本的Xcode中完美运行,但现在它没有显示任何内容.它只显示活动指示器显示"正在运行的项目"

import UIKit
import PlaygroundSupport

let container = UIView()
container.frame.size = CGSize(width: 215.0, height: 215.0)

var view = UIView()
view.frame.size = CGSize(width: 185.0, height: 185.0)
view.center = container.center
view.layer.cornerRadius = view.frame.size.height/2
view.backgroundColor = UIColor.white

container.addSubview(view)

let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")
scaleAnimation.fromValue = CGFloat(0.6)
scaleAnimation.toValue = CGFloat(1.15)
scaleAnimation.timingFunction = CAMediaTimingFunction(name:    kCAMediaTimingFunctionEaseOut)
scaleAnimation.isRemovedOnCompletion = false

let opacityAnimation = CABasicAnimation(keyPath: "opacity")
opacityAnimation.fromValue = CGFloat(0.0)
opacityAnimation.toValue = CGFloat(0.1)
opacityAnimation.duration = 1
opacityAnimation.isRemovedOnCompletion = false
opacityAnimation.autoreverses = true;


let circleAnimations: CAAnimationGroup = CAAnimationGroup()
circleAnimations.duration = 2
circleAnimations.repeatCount = HUGE;
circleAnimations.animations = [scaleAnimation, opacityAnimation];

view.layer .add(circleAnimations, forKey: "circleAnimations")

PlaygroundPage.current.liveView = container
PlaygroundPage.current.needsIndefiniteExecution = true
Run Code Online (Sandbox Code Playgroud)

这有什么问题?

Bla*_*nom 11

您需要启用助理编辑器才能查看结果.

查看>助理编辑器>显示助理编辑器

另请参见此处: iOS Playground不显示UI预览 在此输入图像描述