forked from pocketsvg/PocketSVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSVGImageView.h
98 lines (77 loc) · 2.47 KB
/
SVGImageView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* This file is part of the PocketSVG package.
* Copyright (c) Ponderwell, Ariel Elkin, Fjölnir Ásgeirsson, and Contributors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "SVGPortability.h"
NS_ASSUME_NONNULL_BEGIN
/// A view that renders an SVG file.
IB_DESIGNABLE
@interface SVGImageView : PSVGView
/*!
* @discussion Initialises a view that renders the provided SVG data.
*
* @param svgSource The entire string of the XML document representing the SVG.
*
* @code let url = NSBundle.mainBundle().URLForResource("svg_file_name", withExtension: "svg")!
let svgSource = try! NSString(contentsOfURL: url, encoding: NSUTF8StringEncoding) as String
let layer = SVGLayer(SVGSource: svgSource)
// set the layer's frame and add it as a sublayer to display it.
*
*/
- (instancetype)initWithSVGSource:(NSString *)svgSource;
/*!
* @discussion Initialises a view that renders the provided SVG.
*
* @param url The URL of the SVG file.
*
* @code let url = NSBundle.mainBundle().URLForResource("svg_file_name", withExtension: "svg")!
let svgImageView = SVGImageView(contentsOfURL: url)
*
*/
- (instancetype)initWithContentsOfURL:(NSURL *)url;
/*!
* @discussion Clears contents and renders a new SVG given the filename in the main bundle.
*
* @param svgName The filename of an SVG in the main bundle.
*
*/
@property(nonatomic, copy) IBInspectable NSString *svgName;
/*!
* @discussion Clears contents and renders a new SVG given its complete XML representation.
*
* @param svgSource The entire string of the XML document representing the SVG.
*
*/
- (void)setSvgSource:(NSString *)svgSource;
/*!
* @discussion Clears contents and renders a new SVG given the URL of the SVG.
*
* @param svgURL The XML string of an SVG.
*
*/
@property (nonatomic, copy) NSURL *svgURL;
/*!
* @discussion Solidly fills the shape formed by the SVG path with the given color.
*
* @param fillColor A color to fill the SVG shape with.
*
*/
@property(nonatomic, copy) IBInspectable PSVGColor *fillColor;
/*!
* @discussion Solidly colors the path generated by the SVG file.
*
* @param strokeColor The color to stroke the path with.
*
*/
@property(nonatomic, copy) IBInspectable PSVGColor *strokeColor;
/*!
* @discussion Specifies whether or not line thickness should be scaled
when scaling paths.
*
*/
@property(nonatomic) IBInspectable BOOL scaleLineWidth;
@end
NS_ASSUME_NONNULL_END