This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
import UIKit | |
private class Line { | |
var path = UIBezierPath() | |
var layer = CAShapeLayer() | |
} | |
private enum AnimationKey { | |
static let activeStart = "ActiveLineStartAnimation" |
(function () { | |
l1 = 'STEP 1'; | |
console.log(l1); // Output: STEP 1 | |
if (true) { | |
console.log(l1); // Output: STEP 1 | |
var l1 = 'STEP 2'; // var isn't block-scoped, gets hoisted | |
console.log(l1); // Output: STEP 2 | |
} |
// int num = null; -> Error | |
int? num = null; | |
if (num.HasValue) | |
{ | |
System.Console.WriteLine("num = " + num.Value); | |
} | |
else | |
{ | |
System.Console.WriteLine("num = Null"); |
var text: String? | |
print(text) | |
// Output: nil | |
print(text ?? "B") | |
// Output: B | |
text = "A" | |
print(text ?? "B") | |
// Output: A | |
print(text) | |
// Output: Optional("A") |
// Declare an optional variable | |
var name: String? = "Roman" | |
guard let name = name else { | |
print("name is nil") | |
return | |
} | |
print(name) | |
// Output: Roman |
/* Example JSON Object | |
{ | |
"key": { | |
"nestedKey": { | |
"nestedKey": { | |
"nestedKey": 42.0 | |
} | |
} | |
} |
// Declare two optional values | |
var firstName: String? = "Roman" | |
var lastName: String? = "Blum" | |
// Option 1: Nested | |
if let firstName = firstName { | |
if let lastName = lastName { | |
// Use firstName and lastName | |
} | |
} |
// Declare an optional value | |
var name: String? = "Roman" | |
// Optional chaining | |
name?.characters.count | |
if name != nil { | |
// Force unwrap | |
name!.characters.count | |
} |
// Declare three optional variables | |
var firstName: String? | |
var lastName: String? | |
var age: Int? | |
// EXAMPLE: if-Statement | |
if let firstName = firstName { | |
if let lastName = lastName { | |
if let age = age, age >= 18 { | |
doSomething(firstName, lastName, age) |