Skip to content

Commit

Permalink
Access modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mchoe committed Jul 28, 2017
1 parent 9290864 commit 3280762
Show file tree
Hide file tree
Showing 160 changed files with 1,462 additions and 709 deletions.
2 changes: 1 addition & 1 deletion SwiftSVG/SVG/Attributes/DelaysApplyingAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension DelaysApplyingAttributes where Self : SVGElement {
/**
Applies any saved and supported attributes
*/
func applyDelayedAttributes() {
public func applyDelayedAttributes() {
for (attribute, value) in self.delayedAttributes {
guard let closure = self.supportedAttributes[attribute] else {
continue
Expand Down
6 changes: 3 additions & 3 deletions SwiftSVG/SVG/Cache/SVGCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
open class SVGCache {

/// A singleton object that is the default store for `SVGlayer`s
static let `default` = SVGCache()
public static let `default` = SVGCache()

/// :nodoc:
private let memoryCache = NSCache<NSString, SVGLayer>()
public let memoryCache = NSCache<NSString, SVGLayer>()

/// Subscript to get or set the `SVGLayer` in this cache
subscript(key: String) -> SVGLayer? {
public subscript(key: String) -> SVGLayer? {
get {
return self.memoryCache.object(forKey: key as NSString)
}
Expand Down
1 change: 1 addition & 0 deletions SwiftSVG/SVG/Elements/ParsesAsynchronously.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
protocol CanManageAsychronousParsing {
/**
The callback called when an `ParsesAsynchronously` element has finished parsing
- Parameter shapeLayer: The completed layer
*/
func finishedProcessing(_ shapeLayer: CAShapeLayer)
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG/Elements/SVGCircle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
final class SVGCircle: SVGShapeElement {

/// :nodoc:
static let elementName = "circle"
internal static let elementName = "circle"

/**
The circle's center point. Defaults to `CGRect.zero`
Expand Down Expand Up @@ -93,7 +93,7 @@ final class SVGCircle: SVGShapeElement {
/**
Function that is called after the circle's center and radius have been parsed and set. This function creates the path and sets the internal `SVGLayer`'s path.
*/
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG/Elements/SVGEllipse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
final class SVGEllipse: SVGShapeElement {

/// :nodoc:
static let elementName = "ellipse"
internal static let elementName = "ellipse"

/**
The ellipse's center point. Defaults to `CGRect.zero`
Expand Down Expand Up @@ -106,7 +106,7 @@ final class SVGEllipse: SVGShapeElement {
/**
Function that is called after the ellipse's center and radius have been parsed and set. This function creates the path and sets the internal `SVGLayer`'s path.
*/
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG/Elements/SVGGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final class SVGGroup: SVGContainerElement {
]

/// :nodoc:
static let elementName = "g"
internal static let elementName = "g"

/// Store all attributes and values to be applied after all known sublayers have been added to this container
internal var delayedAttributes = [String : String]()
Expand All @@ -67,7 +67,7 @@ final class SVGGroup: SVGContainerElement {
/**
The function that is called after all of this group's subelements have been processed. It will apply all stored `delayedAttributes` on all sublayers
*/
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {

guard let containerSublayers = self.containerLayer.sublayers else {
return
Expand Down
12 changes: 6 additions & 6 deletions SwiftSVG/SVG/Elements/SVGLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@
final class SVGLine: SVGShapeElement {

/// :nodoc:
static let elementName = "line"
internal static let elementName = "line"

/**
The line's end point. Defaults to `CGPoint.zero`
*/
var end = CGPoint.zero
internal var end = CGPoint.zero

/**
The line's end point. Defaults to `CGPoint.zero`
*/
var start = CGPoint.zero
internal var start = CGPoint.zero

/// :nodoc:
var svgLayer = CAShapeLayer()
internal var svgLayer = CAShapeLayer()

/// :nodoc:
var supportedAttributes: [String : (String) -> ()] = [:]
internal var supportedAttributes: [String : (String) -> ()] = [:]

/**
Function parses a number string and sets this line's start `x`
Expand Down Expand Up @@ -103,7 +103,7 @@ final class SVGLine: SVGShapeElement {
/**
Draws a line from the `startPoint` to the `endPoint`
*/
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
25 changes: 12 additions & 13 deletions SwiftSVG/SVG/Elements/SVGPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@
final class SVGPath: SVGShapeElement, ParsesAsynchronously, DelaysApplyingAttributes {

/// :nodoc:
static let elementName = "path"
internal static let elementName = "path"

/**
Attributes that are applied after the path has been processed
*/
var delayedAttributes = [String : String]()
internal var delayedAttributes = [String : String]()

/// :nodoc:
var asyncParseManager: CanManageAsychronousParsing? = nil
internal var asyncParseManager: CanManageAsychronousParsing? = nil

/**
Flag that sets whether the path should be parsed asynchronously or not
*/
var shouldParseAsynchronously = true
internal var shouldParseAsynchronously = true

/// :nodoc:
var supportedAttributes = [String : (String) -> ()]()
internal var supportedAttributes = [String : (String) -> ()]()

/// :nodoc:
var svgLayer = CAShapeLayer()
internal var svgLayer = CAShapeLayer()

/// :nodoc:
init() { }
internal init() { }


/**
Expand All @@ -72,7 +72,7 @@ final class SVGPath: SVGShapeElement, ParsesAsynchronously, DelaysApplyingAttrib
```
- parameter singlePathString: The `d` attribute value of a `<path>` element
*/
init(singlePathString: String) {
internal init(singlePathString: String) {
self.shouldParseAsynchronously = false
self.parseD(singlePathString)
}
Expand All @@ -99,10 +99,9 @@ final class SVGPath: SVGShapeElement, ParsesAsynchronously, DelaysApplyingAttrib
if self.shouldParseAsynchronously {

let concurrent = DispatchQueue(label: "com.straussmade.swiftsvg.path.concurrent", attributes: .concurrent)
let dispatchGroup = DispatchGroup()

concurrent.async(group: dispatchGroup, execute: parsePathClosure)
dispatchGroup.notify(queue: DispatchQueue.main) {
concurrent.async(execute: parsePathClosure)
concurrent.async(flags: .barrier) {
self.svgLayer.path = pathDPath.cgPath
self.applyDelayedAttributes()
self.asyncParseManager?.finishedProcessing(self.svgLayer)
Expand All @@ -118,7 +117,7 @@ final class SVGPath: SVGShapeElement, ParsesAsynchronously, DelaysApplyingAttrib
/**
The clip rule for this path to be applied after the path has been parsed
*/
func clipRule(_ clipRule: String) {
internal func clipRule(_ clipRule: String) {
guard let thisPath = self.svgLayer.path else {
self.delayedAttributes["clip-rule"] = clipRule
return
Expand All @@ -135,7 +134,7 @@ final class SVGPath: SVGShapeElement, ParsesAsynchronously, DelaysApplyingAttrib
}

/// :nodoc:
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
8 changes: 4 additions & 4 deletions SwiftSVG/SVG/Elements/SVGPolygon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
struct SVGPolygon: SVGShapeElement {

/// :nodoc:
static let elementName = "polygon"
internal static let elementName = "polygon"

/// :nodoc:
var supportedAttributes: [String : (String) -> ()] = [:]
internal var supportedAttributes: [String : (String) -> ()] = [:]

/// :nodoc:
var svgLayer = CAShapeLayer()
internal var svgLayer = CAShapeLayer()

/**
Function that parses a coordinate string and creates a polygon path
Expand All @@ -66,7 +66,7 @@ struct SVGPolygon: SVGShapeElement {
}

/// :nodoc:
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
8 changes: 4 additions & 4 deletions SwiftSVG/SVG/Elements/SVGPolyline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
struct SVGPolyline: SVGShapeElement {

/// :nodoc:
static let elementName = "polyline"
internal static let elementName = "polyline"

/// :nodoc:
var supportedAttributes: [String : (String) -> ()] = [:]
internal var supportedAttributes: [String : (String) -> ()] = [:]

/// :nodoc:
var svgLayer = CAShapeLayer()
internal var svgLayer = CAShapeLayer()

/**
Parses a coordinate string and creates a new polyline based on them
Expand All @@ -65,7 +65,7 @@ struct SVGPolyline: SVGShapeElement {
}

/// :nodoc:
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
26 changes: 13 additions & 13 deletions SwiftSVG/SVG/Elements/SVGRectangle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@
final class SVGRectangle: SVGShapeElement {

/// :nodoc:
static let elementName = "rect"
internal static let elementName = "rect"

/**
The CGRect for the rectangle
*/
var rectangleRect = CGRect()
internal var rectangleRect = CGRect()

/// :nodoc:
var svgLayer = CAShapeLayer()
internal var svgLayer = CAShapeLayer()

/// :nodoc:
var supportedAttributes: [String : (String) -> ()] = [:]
internal var supportedAttributes: [String : (String) -> ()] = [:]

/**
The x radius of the corner oval. Defaults to `0`
*/
var xCornerRadius = CGFloat(0.0)
internal var xCornerRadius = CGFloat(0.0)

/**
The y radius of the corner oval. Defaults to `0`
*/
var yCornerRadius = CGFloat(0.0)
internal var yCornerRadius = CGFloat(0.0)

/**
Function that parses the number string and sets this rectangle's origin x
*/
func parseX(x: String) {
internal func parseX(x: String) {
guard let x = CGFloat(x) else {
return
}
Expand All @@ -77,7 +77,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Function that parses the number string and sets this rectangle's origin y
*/
func parseY(y: String) {
internal func parseY(y: String) {
guard let y = CGFloat(y) else {
return
}
Expand All @@ -87,7 +87,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Function that parses the number string and sets this rectangle's height
*/
func rectangleHeight(height: String) {
internal func rectangleHeight(height: String) {
guard let height = CGFloat(height) else {
return
}
Expand All @@ -97,7 +97,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Function that parses the number string and sets this rectangle's width
*/
func rectangleWidth(width: String) {
internal func rectangleWidth(width: String) {
guard let width = CGFloat(width) else {
return
}
Expand All @@ -107,7 +107,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Function that parses the number string and sets this rectangle's x corner radius
*/
func xCornerRadius(xCornerRadius: String) {
internal func xCornerRadius(xCornerRadius: String) {
guard let xCornerRadius = CGFloat(xCornerRadius) else {
return
}
Expand All @@ -117,7 +117,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Function that parses the number string and sets this rectangle's y corner radius
*/
func yCornerRadius(yCornerRadius: String) {
internal func yCornerRadius(yCornerRadius: String) {
guard let yCornerRadius = CGFloat(yCornerRadius) else {
return
}
Expand All @@ -127,7 +127,7 @@ final class SVGRectangle: SVGShapeElement {
/**
Creates a new rectangle path based on the set attributes.
*/
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
guard let container = container else {
return
}
Expand Down
12 changes: 6 additions & 6 deletions SwiftSVG/SVG/Elements/SVGRootElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
struct SVGRootElement: SVGContainerElement {

/// :nodoc:
static let elementName = "svg"
internal static let elementName = "svg"

// :nodoc:
var delayedAttributes = [String : String]()
internal var delayedAttributes = [String : String]()

// :nodoc:
var containerLayer = CALayer()
internal var containerLayer = CALayer()

// :nodoc:
var supportedAttributes = [String : (String) -> ()]()
internal var supportedAttributes = [String : (String) -> ()]()

/**
Function that parses a number string and sets the `containerLayer`'s width
Expand All @@ -71,12 +71,12 @@ struct SVGRootElement: SVGContainerElement {
}

/// :nodoc:
func didProcessElement(in container: SVGContainerElement?) {
internal func didProcessElement(in container: SVGContainerElement?) {
return
}

/// nodoc:
func viewBox(coordinates: String) {
internal func viewBox(coordinates: String) {
let points = coordinates
.components(separatedBy: CharacterSet(charactersIn: ", "))
.flatMap { (thisString) -> Double? in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension BinaryFloatingPoint {
/**
Parses a number string with optional suffix, such as `px`, `mm`
*/
init?(lengthString: String) {
internal init?(lengthString: String) {

let simpleNumberClosure: (String) -> Double? = { (string) -> Double? in
return Double(string)
Expand Down
Loading

0 comments on commit 3280762

Please sign in to comment.