This file contains hidden or 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
| extension Array where Element == XLayoutDimensionConstraint { | |
| /// Activates Dimensional Constraints | |
| /// - Parameter childView: child view for which constraints are to be added | |
| func activateConstraints(for childView: UIView) { | |
| getConstraints(for: childView).activate() | |
| } | |
| func getConstraints(for childView: UIView) -> [NSLayoutConstraint] { | |
| return map { constraints in |
This file contains hidden or 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
| var store: [String: String] = [:] | |
| DispatchQueue.concurrentPerform(iterations: 1_000_000) { i in | |
| store["aKey"] = "\(i)" | |
| _ = store["aKey"] | |
| } |
This file contains hidden or 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
| class A { | |
| var b: B? | |
| deinit { | |
| print("deinit called for A") | |
| } | |
| } | |
| class B { | |
| var a: A? |
This file contains hidden or 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
| import Foundation | |
| import UIKit | |
| import PlaygroundSupport | |
| struct Point { | |
| var x: Int | |
| var y: Int | |
| } | |
| extension Point { |
This file contains hidden or 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
| let x=100,y=100; | |
| function setup() { | |
| createCanvas(400, 400); | |
| } | |
| function draw() { | |
| background(220); | |
| circle(x,y,100); | |
| x=x+1; | |
| y=y+1; |
This file contains hidden or 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
| function setup() { | |
| createCanvas(400, 400); | |
| } | |
| function draw() { | |
| background(220); | |
| circle(mouseX,mouseY,100); | |
| } |
This file contains hidden or 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
| function setup() { | |
| createCanvas(400, 400); | |
| } | |
| function draw() { | |
| background(220); | |
| frameRate(1); // To visualize the effect | |
| circle(100,200,100); // the fill color will be pink after one call-1 sec | |
This file contains hidden or 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
| function setup() { | |
| createCanvas(400, 400); | |
| } | |
| function draw() { | |
| background(220); | |
| circle(100,100,50); | |
| } |
This file contains hidden or 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
| function setup() { | |
| frameRate(3); | |
| createCanvas(400,400); | |
| } | |
| function draw() { | |
| background(random(0,255),random(0,255),random(0,255)); | |
| } |
This file contains hidden or 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
| function setup() { | |
| createCanvas(400, 400); | |
| frameRate(3) | |
| } | |
| function draw() { | |
| background(255,0,0) | |
| } |
NewerOlder