From fffb43c266b74e1c1012092c031a6f5f29de14b8 Mon Sep 17 00:00:00 2001 From: Wojtek Czekalski Date: Sat, 5 Nov 2016 11:04:32 +0100 Subject: [PATCH] Playground fixes for Swift 3 --- Graph.playground/Contents.swift | 6 +++--- Graph.playground/Sources/ViewController.swift | 12 ++++++------ Graph.playground/timeline.xctimeline | 10 ++++++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Graph.playground/Contents.swift b/Graph.playground/Contents.swift index dd244b9..81d132e 100644 --- a/Graph.playground/Contents.swift +++ b/Graph.playground/Contents.swift @@ -1,8 +1,8 @@ //: Playground - noun: a place where people can play import UIKit -import XCPlayground +import PlaygroundSupport -let viewController = GraphViewController(string1: "Playground", string2: "Playful") +let viewController = GraphViewController(string1: "kitten", string2: "sitting") viewController.view.frame = CGRect(x: 0, y: 0, width: 500, height: 500) -XCPlaygroundPage.currentPage.liveView = viewController.view +PlaygroundPage.current.liveView = viewController.view diff --git a/Graph.playground/Sources/ViewController.swift b/Graph.playground/Sources/ViewController.swift index 048aea4..2975c42 100644 --- a/Graph.playground/Sources/ViewController.swift +++ b/Graph.playground/Sources/ViewController.swift @@ -112,11 +112,11 @@ extension Trace { let xDelta = (to.x-from.x)/20 switch type() { - case .Deletion: + case .deletion: return (CGPoint(x: from.x+xDelta, y: from.y), CGPoint(x: to.x-xDelta, y: to.y)) - case .Insertion: + case .insertion: return (CGPoint(x: from.x, y: from.y+yDelta), CGPoint(x: to.x, y: to.y-yDelta)) - case .MatchPoint: + case .matchPoint: return (CGPoint(x: from.x+xDelta, y: from.y+yDelta), CGPoint(x: to.x-xDelta, y: to.y-yDelta)) } }() @@ -127,11 +127,11 @@ extension Trace { let arrowLayer = UIBezierPath(arrow: arrow(on: graph)).shapeLayer() switch type() { - case .Deletion: + case .deletion: arrowLayer.fillColor = UIColor.red.cgColor - case .Insertion: + case .insertion: arrowLayer.fillColor = UIColor.green.cgColor - case .MatchPoint: + case .matchPoint: arrowLayer.fillColor = UIColor.white.cgColor } return arrowLayer diff --git a/Graph.playground/timeline.xctimeline b/Graph.playground/timeline.xctimeline index 0b2fed4..12c47e6 100644 --- a/Graph.playground/timeline.xctimeline +++ b/Graph.playground/timeline.xctimeline @@ -3,15 +3,21 @@ version = "3.0"> + +