In Objective C I was using this code to scale an image to my background. How can I achieve this in Swift.
path = [[NSBundle mainBundle] pathForResource:@"This" ofType:@"png"];
image = [[UIImage alloc] initWithContentsOfFile:path];
In Objective C I was using this code to scale an image to my background. How can I achieve this in Swift.
path = [[NSBundle mainBundle] pathForResource:@"This" ofType:@"png"];
image = [[UIImage alloc] initWithContentsOfFile:path];
you can try this:
path = NSBundle.mainBundle().pathForResource("This", ofType: "png")
image = UIImage(contentsOfFile: path)