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 Token { | |
var isSomething: Bool {get} | |
} | |
struct BasicToken : Token { | |
let isSomething: Bool | |
} | |
struct FancyToken : Token { | |
let isSomething: Bool |
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 | |
//: ## Helpers | |
func string(fromFile name:String, fileExtension:String) -> String? { | |
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) { | |
if let inputData = FileManager.default.contents(atPath: filePath) { | |
return String(data: inputData, encoding: .utf8) | |
} |
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 | |
//: ## Helpers | |
func string(fromFile name:String, fileExtension:String) -> String? { | |
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) { | |
if let inputData = FileManager.default.contents(atPath: filePath) { | |
return String(data: inputData, encoding: .utf8) | |
} |
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
// | |
// ViewController.swift | |
// AdventOfCodeMac | |
// | |
// Created by Scott Atkinson on 12/17/16. | |
// Copyright © 2016 Fathouse Software. All rights reserved. | |
// | |
import Cocoa |
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 | |
//: ## Helpers | |
func string(fromFile name:String, fileExtension:String) -> String? { | |
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) { | |
if let inputData = FileManager.default.contents(atPath: filePath) { | |
return String(data: inputData, encoding: .utf8) | |
} |
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 | |
//: ## Helpers | |
func string(fromFile name:String, fileExtension:String) -> String? { | |
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) { | |
if let inputData = FileManager.default.contents(atPath: filePath) { | |
return String(data: inputData, encoding: .utf8) | |
} |
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 | |
struct Triangle { | |
let vertices: [Int] | |
init?(vertices:[Int]) { | |
guard vertices.count == 3 else { return nil } | |
guard vertices[0] + vertices[1] > vertices[2], |
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 | |
enum Instruction:String { | |
case up = "U" | |
case down = "D" | |
case left = "L" | |
case right = "R" | |
} |
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 | |
enum Instruction:String { | |
case up = "U" | |
case down = "D" | |
case left = "L" | |
case right = "R" | |
} |
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 | |
enum Axis { | |
case X | |
case Y | |
} | |
enum Instruction { | |
case left (distance:Int) |
NewerOlder