You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-9Lines changed: 22 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,19 @@
1
1
2
2

3
3
4
+
```
5
+
⚡⚡⚡ ANNOUNCEMENT ⚡⚡⚡
6
+
A new version of SwiftSVG is coming soon! 2.0 will bring wider support for more elements
7
+
types and attributes, a brand new architecture for greater extensibility, and a faster,
8
+
more stable parser.
9
+
10
+
If you want to try it out, check out the feature/2.0.0 branch or install through Cocoapods:
11
+
12
+
pod 'SwiftSVG', :git => '[email protected]:mchoe/SwiftSVG.git', :branch => 'feature/2.0.0'
13
+
14
+
Stay tuned for more information and thanks for your support!
15
+
```
16
+
4
17
SwiftSVG
5
18
========
6
19
@@ -48,7 +61,7 @@ Usage
48
61
49
62
SwiftSVG provides multiple interfaces to parse single path strings and SVG files using NSXMLParser.
50
63
51
-
####String+SVG####
64
+
###String+SVG
52
65
53
66
The simplest way is to parse raw path data using `parseSVGPath()`
54
67
@@ -70,12 +83,12 @@ Or, you can use the String extension `pathFromSVGString()`:
70
83
let parsedPath: UIBezierPath = examplePathData.pathFromSVGString()
71
84
```
72
85
73
-
#####Output:#####
86
+
####Output:
74
87

75
88
76
89
***
77
90
78
-
####UIBezierPath+SVG####
91
+
###UIBezierPath+SVG
79
92
80
93
SwiftSVG also provides a convenience initializer for UIBezierPath that allows you to either create a `UIBezierPath` from a path string or from an SVG file:
81
94
@@ -93,12 +106,12 @@ let pathFromSVGFile = UIBezierPath.pathWithSVGURL(svgURL)
93
106
shapelayer.path= pathFromSVGFile
94
107
```
95
108
96
-
#####Output:#####
109
+
####Output:
97
110

98
111
99
112
***
100
113
101
-
####CAShapeLayer+SVG####
114
+
###CAShapeLayer+SVG
102
115
103
116
You can create a `CAShapeLayer` from a path string or SVG file:
104
117
@@ -112,7 +125,7 @@ let svgURL = NSBundle.mainBundle().URLForResource("pizza", withExtension: "svg")
112
125
let svgShapeLayerFromFile =CAShapeLayer(SVGURL: svgURL)
113
126
```
114
127
115
-
#####Output:#####
128
+
####Output:
116
129

117
130
118
131
Fill colors are read automatically if provided as an attribute on the path element. The fill attribute must be supplied as a hex value:
@@ -122,7 +135,7 @@ Fill colors are read automatically if provided as an attribute on the path eleme
122
135
123
136
***
124
137
125
-
####UIView+SVG####
138
+
###UIView+SVG
126
139
127
140
A UIView convenince initializer is provided as well. Same thing goes as with CAShapeLayer, you can supply a path string or an SVG file:
128
141
@@ -136,12 +149,12 @@ let svgURL = NSBundle.mainBundle().URLForResource("sockPuppet", withExtension: "
136
149
let svgViewFromFile =UIView(SVGURL: svgURL)
137
150
```
138
151
139
-
#####Output:#####
152
+
####Output:
140
153

141
154
142
155
***
143
156
144
-
####SVGView####
157
+
###SVGView
145
158
146
159
Finally, SwiftSVG provides a `UIView` subclass that is `IBInspectable` and `IBDesignable`. Simply add a view to your storyboard and use the SVGView subclass as you class name. Then put the name of your SVG file in your bundle in the `IBInspectable` property "SVGName"
0 commit comments