Skip to content

Commit

Permalink
Make some structs public
Browse files Browse the repository at this point in the history
  • Loading branch information
onmyway133 committed Nov 27, 2016
1 parent 9ec4c6a commit 39db5ab
Show file tree
Hide file tree
Showing 22 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions Sources/iOS/Command/ClosePathCommand.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation

class ClosePathCommand: Command {
public class ClosePathCommand: Command {

convenience init() {
self.init(string: "", kind: .absolute)
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
path.close()
}
}
12 changes: 6 additions & 6 deletions Sources/iOS/Command/Command.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import Foundation

class Command {
public class Command {

enum Kind {
public enum Kind {
case absolute, relative
}

let kind: Kind
public let kind: Kind

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
self.kind = kind
}

func act(path: UIBezierPath, previousCommand: Command?) {
public func act(path: UIBezierPath, previousCommand: Command?) {

}
}

extension Command {
public extension Command {
class func make(initial: String, string: String) -> Command? {
let type: Command.Type? = availableCommands[initial.uppercased()]
let kind: Kind = Utils.isLowercase(string: initial) ? .relative : .absolute
Expand Down
12 changes: 6 additions & 6 deletions Sources/iOS/Command/CurveToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Foundation

class CurveToCommand: Command {
var controlPoint1: CGPoint = .zero
var controlPoint2: CGPoint = .zero
var endPoint: CGPoint = .zero
public class CurveToCommand: Command {
public var controlPoint1: CGPoint = .zero
public var controlPoint2: CGPoint = .zero
public var endPoint: CGPoint = .zero

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -16,7 +16,7 @@ class CurveToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if kind == .relative {
endPoint = path.currentPoint.add(p: endPoint)
controlPoint1 = path.currentPoint.add(p: controlPoint1)
Expand Down
16 changes: 8 additions & 8 deletions Sources/iOS/Command/EllipticalArcCommand.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Foundation

class EllipticalArcCommand: Command {
var radius: CGPoint = .zero
var rotation: CGFloat = 0
var largeArcFlag: Bool = false
var sweepFlag: Bool = false
var endPoint: CGPoint = .zero
public class EllipticalArcCommand: Command {
public var radius: CGPoint = .zero
public var rotation: CGFloat = 0
public var largeArcFlag: Bool = false
public var sweepFlag: Bool = false
public var endPoint: CGPoint = .zero

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -20,7 +20,7 @@ class EllipticalArcCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
switch kind {
case .absolute:
break
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Command/HorizontalLineToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation

class HorizontalLineToCommand: Command {
var x: CGFloat = 0
public class HorizontalLineToCommand: Command {
public var x: CGFloat = 0

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -12,7 +12,7 @@ class HorizontalLineToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
let end: CGPoint

switch kind {
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Command/LineToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation

class LineToCommand: Command {
var point: CGPoint = .zero
public class LineToCommand: Command {
public var point: CGPoint = .zero

required init(string: String, kind: Kind) {
required public init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -12,7 +12,7 @@ class LineToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if kind == .relative {
point = path.currentPoint.add(p: point)
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Command/MoveToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation

class MoveToCommand: Command {
var point: CGPoint = .zero
public class MoveToCommand: Command {
public var point: CGPoint = .zero

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -12,7 +12,7 @@ class MoveToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if kind == .relative {
point = path.currentPoint.add(p: point)
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/iOS/Command/QuadraticBezierCurveCommand.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Foundation

class QuadraticBezierCurveCommand: Command {
var controlPoint: CGPoint = .zero
var endPoint: CGPoint = .zero
public class QuadraticBezierCurveCommand: Command {
public var controlPoint: CGPoint = .zero
public var endPoint: CGPoint = .zero

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -14,7 +14,7 @@ class QuadraticBezierCurveCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if kind == .relative {
endPoint = path.currentPoint.add(p: endPoint)
controlPoint = path.currentPoint.add(p: controlPoint)
Expand Down
12 changes: 6 additions & 6 deletions Sources/iOS/Command/SmoothCurveToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Foundation

class SmoothCurveToCommand: Command {
var controlPoint1: CGPoint = .zero
var controlPoint2: CGPoint = .zero
var endPoint: CGPoint = .zero
public class SmoothCurveToCommand: Command {
public var controlPoint1: CGPoint = .zero
public var controlPoint2: CGPoint = .zero
public var endPoint: CGPoint = .zero

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -15,7 +15,7 @@ class SmoothCurveToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if let previousCommand = previousCommand as? CurveToCommand {
controlPoint1 = previousCommand.controlPoint2.reflect(around: path.currentPoint)
} else if let previousCommand = previousCommand as? SmoothCurveToCommand {
Expand Down
10 changes: 5 additions & 5 deletions Sources/iOS/Command/SmoothQuadraticBezierCurveToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Foundation

class SmoothQuadraticBezierCurveToCommand: Command {
var controlPoint: CGPoint = .zero
var endPoint: CGPoint = .zero
public class SmoothQuadraticBezierCurveToCommand: Command {
public var controlPoint: CGPoint = .zero
public var endPoint: CGPoint = .zero

required init(string: String, kind: Kind) {
required public init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -13,7 +13,7 @@ class SmoothQuadraticBezierCurveToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
if let previousCommand = previousCommand as? QuadraticBezierCurveCommand {
controlPoint = previousCommand.controlPoint.reflect(around: path.currentPoint)
} else if let previousCommand = previousCommand as? SmoothQuadraticBezierCurveToCommand {
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Command/VerticalLineToCommand.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation

class VerticalLineToCommand: Command {
var y: CGFloat = 0
public class VerticalLineToCommand: Command {
public var y: CGFloat = 0

required init(string: String, kind: Kind) {
public required init(string: String, kind: Kind) {
super.init(string: string, kind: kind)

let numbers = Utils.numbers(string: string)
Expand All @@ -12,7 +12,7 @@ class VerticalLineToCommand: Command {
}
}

override func act(path: UIBezierPath, previousCommand: Command?) {
public override func act(path: UIBezierPath, previousCommand: Command?) {
let end: CGPoint

switch kind {
Expand Down
20 changes: 10 additions & 10 deletions Sources/iOS/Document/Style.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Foundation

class Style {
var strokeColor: UIColor?
let strokeWidth: CGFloat
var fillColor: UIColor?
let opacity: CGFloat
var fillRule: String?
var lineCap: String?
var lineJoin: String?
var miterLimit: CGFloat?
public class Style {
public var strokeColor: UIColor?
public let strokeWidth: CGFloat
public var fillColor: UIColor?
public let opacity: CGFloat
public var fillRule: String?
public var lineCap: String?
public var lineJoin: String?
public var miterLimit: CGFloat?

init(attributes: JSONDictionary) {
public init(attributes: JSONDictionary) {
var attributes = attributes

if let string = attributes.string(key: "style") {
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Shape/Circle.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import UIKit
import Reindeer

class Circle: Shape {
let center: CGPoint
let radius: CGFloat
public class Circle: Shape {
public let center: CGPoint
public let radius: CGFloat

required init(element: Element) {
required public init(element: Element) {
self.center = CGPoint(x: element.attributes.number(key: "cx") ?? 0,
y: element.attributes.number(key: "cy") ?? 0)
self.radius = element.attributes.number(key: "r") ?? 0
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Shape/Ellipse.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import UIKit
import Reindeer

class Ellipse: Shape {
let center: CGPoint
let radius: CGPoint
public class Ellipse: Shape {
public let center: CGPoint
public let radius: CGPoint

required init(element: Element) {
public required init(element: Element) {
self.center = CGPoint(x: element.attributes.number(key: "cx") ?? 0,
y: element.attributes.number(key: "cy") ?? 0)
self.radius = CGPoint(x: element.attributes.number(key: "rx") ?? 0,
Expand Down
6 changes: 3 additions & 3 deletions Sources/iOS/Shape/Image.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import UIKit
import Reindeer

class Image: Shape {
public class Image: Shape {

required init(element: Element) {
public required init(element: Element) {
super.init(element: element)
}

override var layer: CALayer {
public override var layer: CALayer {
let layer = CATextLayer()

return layer
Expand Down
8 changes: 4 additions & 4 deletions Sources/iOS/Shape/Line.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import UIKit
import Reindeer

class Line: Shape {
let point1: CGPoint
let point2: CGPoint
public class Line: Shape {
public let point1: CGPoint
public let point2: CGPoint

required init(element: Element) {
public required init(element: Element) {
self.point1 = CGPoint(x: element.attributes.number(key: "x1") ?? 0,
y: element.attributes.number(key: "y1") ?? 0)
self.point2 = CGPoint(x: element.attributes.number(key: "x2") ?? 0,
Expand Down
6 changes: 3 additions & 3 deletions Sources/iOS/Shape/PathShape.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import UIKit
import Reindeer

class PathShape: Shape {
public class PathShape: Shape {

let commands: [Command]
public let commands: [Command]

required init(element: Element) {
public required init(element: Element) {
self.commands = PathShape.parse(string: element.attributes.string(key: "d") ?? "")

super.init(element: element)
Expand Down
6 changes: 3 additions & 3 deletions Sources/iOS/Shape/Polygon.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import UIKit
import Reindeer

class Polygon: Shape {
var points: [CGPoint] = []
public class Polygon: Shape {
public var points: [CGPoint] = []

required init(element: Element) {
public required init(element: Element) {
self.points = Utils.points(string: element.attributes.string(key: "points"))

super.init(element: element)
Expand Down
6 changes: 3 additions & 3 deletions Sources/iOS/Shape/Polyline.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import UIKit
import Reindeer

class Polyline: Shape {
let points: [CGPoint]
public class Polyline: Shape {
public let points: [CGPoint]

required init(element: Element) {
public required init(element: Element) {
self.points = Utils.points(string: element.attributes.string(key: "points"))

super.init(element: element)
Expand Down
Loading

0 comments on commit 39db5ab

Please sign in to comment.