2017-04-27 2 views
2

Dieser Code funktionierte perfekt in der vorherigen Version von Xcode, aber jetzt zeigt es nichts mehr. Es zeigt nur Aktivitätsanzeige mit der Bezeichnung "Laufendes Projekt"Xcode 8.3.2 Spielplatz Live-View-Rendering funktioniert nicht

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 

Was ist daran falsch?

+0

I-Code eingefügt haben wie zu Xcode 8.3.2 (8E2002) und es funktioniert gut. Getestet auf macOS 10.12.4 (16E195) –

Antwort

0

Manchmal auf dem Spielplatz zu schließen und Xcode Neustart behebt das Problem

Verwandte Themen