This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class MyViewController : UIViewController { | |
override func loadView() { | |
let view = UIView() | |
view.backgroundColor = .white | |
self.view = view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Shorthand for assigning value only if value is not nil | |
infix operator ?= | |
public func ?= <T>(left: inout T, right: T?) { | |
if let right = right { | |
left = right | |
} | |
} | |
let fl0 = CGFloat(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
//Changing values | |
var initialVelocity: CGFloat = 0 | |
var runningTime: CGFloat = 0 | |
var myProperty: CGFloat = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dragger = new Layer | |
x: 0 | |
y: 100 | |
width: 100 | |
height: 100 | |
Dragger.draggable.enabled = true | |
Dragger.on Events.DragMove, (event)-> | |
event = Events.touchEvent(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LayerWidth = 64 | |
Dragger = new Layer width:LayerWidth*5, y:280, x:0, height: LayerWidth | |
Dragger.draggable.speedY = 0 | |
Dragger.draggable.enabled = true | |
Dragger.on Events.DragEnd, -> | |
# These are two variables you can tweak for different effects | |
Sliding = true | |
constant1 = 1000 | |
constant2 = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layer = new Layer width:200, height:200 | |
layer.draggable.enabled = true | |
layer.center() | |
layer.html = "Layer" | |
isDragging=false | |
isHolding = false | |
isHoldingandDragging = false | |
DragStart = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name = new Layer width:400, x: 120, y:540, z:4, opacity:1, backgroundColor: "blue" | |
Name.html = "" | |
Name.style = | |
fontSize: '64px' | |
textAlign: 'center' | |
fontFamily: 'HelveticaNeue-Light' | |
lineHeight: '125px' | |
Name.on Events.TouchStart, -> | |
#Text to be typed |