Skip to content

Commit

Permalink
Merge conflict with podspec version
Browse files Browse the repository at this point in the history
  • Loading branch information
mchoe committed Mar 31, 2019
2 parents 5be877a + a82893b commit f0e5801
Show file tree
Hide file tree
Showing 28 changed files with 175 additions and 890 deletions.
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Table of Contents
Install
=======

| Swift version | SwiftSVG version |
| ------------- | ----------------------------------------------------------- |
| Swift 5.0 | v2.3.0 |
| Swift 4.2 | v2.2.1 |

Cocoapods:

pod 'SwiftSVG', '~> 2.0'
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Pod::Spec.new do |s|

s.name = "SwiftSVG"
s.version = "2.2.1"
s.version = "2.3.0"
s.summary = "A simple, performant, single pass SVG parser"
s.description = "A simple, performant, single pass SVG parser. Optimized for extension and developer joy."
s.homepage = "https://github.com/mchoe/SwiftSVG"
Expand All @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.source = { :git => "https://github.com/mchoe/SwiftSVG.git", :tag => "v#{s.version}" }
s.source_files = "SwiftSVG", "SwiftSVG/**/*.{h,swift}"
s.swift_version = "4.2"
s.swift_version = "5.0"
end
13 changes: 7 additions & 6 deletions SwiftSVG.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Strauss LLC";
TargetAttributes = {
176BC98F1EE474D100F7B54C = {
Expand All @@ -572,7 +572,7 @@
};
39B8D88B1B3C3283009DAF60 = {
CreatedOnToolsVersion = 6.3.2;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
};
};
Expand All @@ -581,6 +581,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -836,8 +837,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator appletvsimulator appletvos iphoneos macosx";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -864,8 +864,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator appletvsimulator appletvos iphoneos macosx";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -876,6 +875,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -937,6 +937,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions SwiftSVG/NSBezierPath+CrossPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public extension NSBezierPath {
}
}

public func addLine(to point: NSPoint) {
func addLine(to point: NSPoint) {
self.line(to: point)
}

public func addCurve(to point: NSPoint, controlPoint1: NSPoint, controlPoint2: NSPoint) {
func addCurve(to point: NSPoint, controlPoint1: NSPoint, controlPoint2: NSPoint) {
self.curve(to: point, controlPoint1: controlPoint1, controlPoint2: controlPoint2)
}

public func addQuadCurve(to point: NSPoint, controlPoint: NSPoint) {
func addQuadCurve(to point: NSPoint, controlPoint: NSPoint) {
self.curve(to: point,
controlPoint1: NSPoint(
x: (controlPoint.x - self.currentPoint.x) * (2.0 / 3.0) + self.currentPoint.x,
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG Extensions/CALayer+SVG.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public extension CALayer {
- Parameter completion: A required completion block to execute once the SVG has completed parsing. You must add the passed `SVGLayer` to a sublayer to display it.
*/
@discardableResult
public convenience init(SVGURL: URL, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
convenience init(SVGURL: URL, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
do {
let svgData = try Data(contentsOf: SVGURL)
self.init(SVGData: svgData, parser: parser, completion: completion)
Expand All @@ -67,7 +67,7 @@ public extension CALayer {
- Parameter completion: A required completion block to execute once the SVG has completed parsing. You must add the passed `SVGLayer` to a sublayer to display it.
*/
@discardableResult
public convenience init(SVGData: Data, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
convenience init(SVGData: Data, parser: SVGParser? = nil, completion: @escaping (SVGLayer) -> ()) {
self.init()

if let cached = SVGCache.default[SVGData.cacheKey] {
Expand Down
2 changes: 1 addition & 1 deletion SwiftSVG/SVG Extensions/CAShapeLayer+SVG.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public extension CAShapeLayer {
Convenience initalizer that synchronously parses a single path string and returns a `CAShapeLayer`
- Parameter pathString: The path `d` string to parse.
*/
public convenience init(pathString: String) {
convenience init(pathString: String) {
self.init()
let singlePath = SVGPath(singlePathString: pathString)
self.path = singlePath.svgLayer.path
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG Extensions/SVGLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public extension SVGLayerType where Self: CALayer {
- TODO: Should eventually support different content modes
*/
@discardableResult
public func resizeToFit(_ rect: CGRect) -> Self {
func resizeToFit(_ rect: CGRect) -> Self {

let boundingBoxAspectRatio = self.boundingBox.width / self.boundingBox.height
let viewAspectRatio = rect.width / rect.height
Expand Down Expand Up @@ -86,7 +86,7 @@ public extension SVGLayer {
/**
Returns a copy of the given SVGLayer
*/
public var svgLayerCopy: SVGLayer? {
var svgLayerCopy: SVGLayer? {
let tmp = NSKeyedArchiver.archivedData(withRootObject: self)
let copiedLayer = NSKeyedUnarchiver.unarchiveObject(with: tmp) as? SVGLayer
copiedLayer?.boundingBox = self.boundingBox
Expand Down
4 changes: 2 additions & 2 deletions SwiftSVG/SVG Extensions/UIBezierPath+SVG.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public extension UIBezierPath {
Parses a single path string. Parses synchronously.
- Parameter pathString: The path `d` string to parse.
*/
public convenience init(pathString: String) {
convenience init(pathString: String) {
let singlePath = SVGPath(singlePathString: pathString)
guard let cgPath = singlePath.svgLayer.path else {
self.init()
Expand All @@ -59,7 +59,7 @@ public extension UIBezierPath {


@available(*, deprecated, message: "This method is deprecated. If you want to parse a single path, instantiate a new instance of SVGPath using the SVGPath(singlePathString:) initializer and pass the path string.")
public class func pathWithSVGURL(_ SVGURL: URL) -> UIBezierPath? {
class func pathWithSVGURL(_ SVGURL: URL) -> UIBezierPath? {
assert(false, "This method is deprecated")
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions SwiftSVG/SVG Extensions/UIView+SVG.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public extension UIView {
```
- Parameter pathString: The path `d` string to parse.
*/
public convenience init(pathString: String) {
convenience init(pathString: String) {
self.init()
let svgLayer = SVGLayer()
let pathPath = UIBezierPath(pathString: pathString)
Expand All @@ -69,7 +69,7 @@ public extension UIView {
- Parameter parser: The optional parser to use to parse the SVG file
- Parameter completion: A required completion block to execute once the SVG has completed parsing. The passed `SVGLayer` will be added to this view's sublayers before executing the completion block
*/
public convenience init(SVGNamed: String, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {
convenience init(SVGNamed: String, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {

// TODO: This is too many guards to really make any sense. Also approaching on the
// pyramid of death Refactor this at some point to be able to work cross-platform.
Expand Down Expand Up @@ -129,7 +129,7 @@ public extension UIView {
- Parameter parser: The optional parser to use to parse the SVG file
- Parameter completion: A required completion block to execute once the SVG has completed parsing. The passed `SVGLayer` will be added to this view's sublayers before executing the completion block
*/
public convenience init(SVGURL: URL, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {
convenience init(SVGURL: URL, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {
do {
let svgData = try Data(contentsOf: SVGURL)
self.init(SVGData: svgData, parser: parser, completion: completion)
Expand All @@ -150,7 +150,7 @@ public extension UIView {
- Parameter parser: The optional parser to use to parse the SVG file
- Parameter completion: A required completion block to execute once the SVG has completed parsing. The passed `SVGLayer` will be added to this view's sublayers before executing the completion block
*/
public convenience init(SVGData svgData: Data, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {
convenience init(SVGData svgData: Data, parser: SVGParser? = nil, completion: ((SVGLayer) -> ())? = nil) {
self.init()

CALayer(SVGData: svgData, parser: parser) { [weak self] (svgLayer) in
Expand Down
16 changes: 8 additions & 8 deletions SwiftSVG/SVG/Elements/SVGGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fileprivate extension SVGGroup {
/**
Function that applies the fill color on all of this group's subelements
*/
fileprivate func fillGroup(_ fillColor: String, on layer: CAShapeLayer) {
func fillGroup(_ fillColor: String, on layer: CAShapeLayer) {
guard let fillColor = UIColor(svgString: fillColor) else {
return
}
Expand All @@ -110,7 +110,7 @@ fileprivate extension SVGGroup {
/**
Function that applies the fill rule on all of this group's subelements
*/
fileprivate func fillRuleGroup(_ fillRule: String, on layer: CAShapeLayer) {
func fillRuleGroup(_ fillRule: String, on layer: CAShapeLayer) {
guard fillRule == "evenodd" else {
return
}
Expand All @@ -120,7 +120,7 @@ fileprivate extension SVGGroup {
/**
Function that applies the fill opacity on all of this group's subelements
*/
fileprivate func fillOpacityGroup(_ opacity: String, on layer: CAShapeLayer) {
func fillOpacityGroup(_ opacity: String, on layer: CAShapeLayer) {
guard let opacity = Float(opacity) else {
return
}
Expand All @@ -134,14 +134,14 @@ fileprivate extension SVGGroup {
/**
Function that applies the stroke line cap on all of this group's subelements
*/
fileprivate func strokeLineCapGroup(lineCap: String, on layer: CAShapeLayer) {
func strokeLineCapGroup(lineCap: String, on layer: CAShapeLayer) {
layer.lineCap = CAShapeLayerLineCap(rawValue: lineCap)
}

/**
Function that applies the stroke color on all of this group's subelements
*/
fileprivate func strokeColorGroup(strokeColor: String, on layer: CAShapeLayer) {
func strokeColorGroup(strokeColor: String, on layer: CAShapeLayer) {
guard let strokeColor = UIColor(svgString: strokeColor) else {
return
}
Expand All @@ -151,14 +151,14 @@ fileprivate extension SVGGroup {
/**
Function that applies the stroke line join on all of this group's subelements
*/
fileprivate func strokeLineJoinGroup(lineJoin: String, on layer: CAShapeLayer) {
func strokeLineJoinGroup(lineJoin: String, on layer: CAShapeLayer) {
layer.lineJoin = CAShapeLayerLineJoin(rawValue: lineJoin)
}

/**
Function that applies the miter limit on all of this group's subelements
*/
fileprivate func strokeMiterLimitGroup(miterLimit: String, on layer: CAShapeLayer) {
func strokeMiterLimitGroup(miterLimit: String, on layer: CAShapeLayer) {
guard let miterLimit = CGFloat(miterLimit) else {
return
}
Expand All @@ -168,7 +168,7 @@ fileprivate extension SVGGroup {
/**
Function that applies the streoke width on all of this group's subelements
*/
fileprivate func strokeWidthGroup(strokeWidth: String, on layer: CAShapeLayer) {
func strokeWidthGroup(strokeWidth: String, on layer: CAShapeLayer) {
guard let strokeWidth = CGFloat(strokeWidth) else {
return
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftSVG/SVG/Helpers/UIColor+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public extension UIColor {
Convenience initializer that creates a new UIColor from a CSS3 named color
- SeeAlso: See here for all the colors: [https://www.w3.org/TR/css3-color/#svg-color](https://www.w3.org/TR/css3-color/#svg-color)
*/
public convenience init?(named: String) {
convenience init?(named: String) {
guard let namedColor = CGColor.named[named] else {
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions SwiftSVG/SVG/Iterators/PathCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ internal extension PathCommand {
/**
Default implementation for any `PathCommand` indicating where there are enough coordinates stored to be able to process the `SVGElement`
*/
internal var canPushCommand: Bool {
var canPushCommand: Bool {
if self.numberOfRequiredParameters == 0 {
return true
}
Expand All @@ -109,21 +109,21 @@ internal extension PathCommand {
/**
Function that clears the current number buffer
*/
internal mutating func clearBuffer() {
mutating func clearBuffer() {
self.coordinateBuffer.removeAll()
}

/**
Adds a new coordinate to the buffer
*/
internal mutating func pushCoordinate(_ coordinate: Double) {
mutating func pushCoordinate(_ coordinate: Double) {
self.coordinateBuffer.append(coordinate)
}

/**
Based on the `PathType` of this PathCommand, this function returns the relative or absolute point
*/
internal func pointForPathType(_ point: CGPoint, relativeTo: CGPoint) -> CGPoint {
func pointForPathType(_ point: CGPoint, relativeTo: CGPoint) -> CGPoint {
switch self.pathType {
case .absolute:
return point
Expand Down
Loading

0 comments on commit f0e5801

Please sign in to comment.