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
protocol OtherType { | |
typealias foo | |
} | |
protocol Foo: OtherType { | |
func extend<S : OtherType where S.foo == Self.foo>(sequence: S) -> S | |
} |
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 Foundation | |
class File: Sequence, Generator { | |
typealias GeneratorType = File | |
typealias Element = String | |
var handle: UnsafePointer<FILE>? | |
init(path: String) { |
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
extension String { | |
subscript (r: Range<Int>) -> String { | |
let indexRange = Range(start: advance(self.startIndex, r.startIndex), end: advance(self.startIndex, r.endIndex)) | |
return self[indexRange] | |
} | |
subscript (i: Int) -> Character { | |
return self[advance(self.startIndex, i)] | |
} | |
} |
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
func async(queue: dispatch_queue_t, f: () -> Void) { | |
dispatch_async(queue, f) | |
} | |
func async(f: () -> Void) { | |
async(dispatch_get_main_queue(), f) | |
} | |
async { | |
println("Hello") |
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
protocol Initializeable { | |
init() | |
} | |
extension Array: Initializeable {} | |
func create<T: Initializeable>(t: T.Type) -> T { | |
return t() | |
} |
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 | |
class TestView: UIView { | |
override func intrinsicContentSize() -> CGSize { | |
return CGSizeMake(100, 100) | |
} | |
} | |
class ViewController: UIViewController { | |
override func viewDidLoad() { |
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
// | |
// Constraints.swift | |
// ConstraintsTest | |
// | |
// Created by Joshua Weinberg on 6/6/14. | |
// Copyright (c) 2014 Joshua Weinberg. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ConstraintTypes.swift | |
// ConstraintsTest | |
// | |
// Created by Joshua Weinberg on 6/8/14. | |
// Copyright (c) 2014 Joshua Weinberg. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ConstraintTypes.swift | |
// ConstraintsTest | |
// | |
import UIKit | |
enum ConstraintDirection { | |
case Natural | |
case LTR |
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
struct ReinterpretSequence<T, U> : Swift.Collection | |
{ | |
typealias IndexType = Int | |
typealias GeneratorType = IndexingGenerator<ReinterpretSequence<T,U>> | |
let value: T | |
var startIndex: IndexType { return 0 } | |
var endIndex: IndexType { return sizeof(T) / sizeof(U) } |
OlderNewer