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
import UIKit | |
// this one doesn’t require a helper function | |
var label: UILabel = { | |
$0.backgroundColor = .blue | |
$0.text = "This is a playground" | |
$0.textColor = .white | |
$0.textAlignment = .center | |
return $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
import Darwin | |
/** | |
Returns a lazy sequence that returns a String for every line of `file`. | |
Example 1: | |
// print all lines from a file | |
let file = fopen(NSBundle.mainBundle().pathForResource("Cartfile", ofType: nil)!,"r") | |
for line in lineGenerator(file) { print(line,separator: "", terminator: "") } | |
fclose(file) |
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
// | |
// Created by Eric Firestone on 3/22/16. | |
// Copyright © 2016 Square, Inc. All rights reserved. | |
// Released under the Apache v2 License. | |
// | |
// Adapted from https://gist.github.com/blakemerryman/76312e1cbf8aec248167 | |
import Foundation | |