Skip to content

Instantly share code, notes, and snippets.

@yvettecook
Created April 26, 2016 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yvettecook/6bace2a0b325646bb523b989abc965e1 to your computer and use it in GitHub Desktop.
Save yvettecook/6bace2a0b325646bb523b989abc965e1 to your computer and use it in GitHub Desktop.
import UIKit
import XCPlayground
let containerView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
containerView.backgroundColor = UIColor.whiteColor()
let square = UIView(frame: CGRect(x: 50, y: 50, width: 100, height: 100))
square.backgroundColor = UIColor.blueColor()
containerView.addSubview(square)
UIView.animateWithDuration(2.0) {
square.backgroundColor = UIColor.redColor()
square.frame = CGRect(x: 200, y: 200, width: 50, height: 50)
}
XCPlaygroundPage.currentPage.liveView = containerView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment