Skip to content

Commit

Permalink
Unbroke initialization
Browse files Browse the repository at this point in the history
I apologize for the previous breaking revision..
  • Loading branch information
fjolnir committed Mar 23, 2017
1 parent 9476343 commit 41ef1b6
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions SVGLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,40 @@ @implementation SVGLayer {
#endif
}

- (void)commonInit
{
_shapeLayers = [NSMutableArray new];
#if TARGET_OS_IPHONE
self.shouldRasterize = YES;
self.rasterizationScale = [[UIScreen mainScreen] scale];
#endif
}

- (instancetype)initWithSVGSource:(NSString *)svgSource {
- (instancetype)init
{
if (self = [super init]) {
[self commonInit];
}
return self;
}

- (instancetype)initWithSVGSource:(NSString *)svgSource
{

if (self = [self init]) {
[self commonInit];
self.svgSource = svgSource;
}
return self;
}

- (instancetype)initWithContentsOfURL:(NSURL *)url {
- (instancetype)initWithContentsOfURL:(NSURL *)url
{

NSString *svgSource = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];

return [self initWithSVGSource:svgSource];
}

- (void)commonInit {
_shapeLayers = [NSMutableArray new];
#if TARGET_OS_IPHONE
self.shouldRasterize = YES;
self.rasterizationScale = [[UIScreen mainScreen] scale];
#endif
}

- (instancetype)initWithCoder:(NSCoder * const)aDecoder
{
if (self = [super initWithCoder:aDecoder]) {
Expand Down

0 comments on commit 41ef1b6

Please sign in to comment.