Last active
October 31, 2019 11:06
-
-
Save craiggrummitt/91e9e5527428bc6e69939079865e3a28 to your computer and use it in GitHub Desktop.
Renders a tiled image in a view. Also renders in the storyboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBDesignable | |
class TiledImageView:UIView { | |
@IBInspectable var image:UIImage? | |
override func draw(_ rect: CGRect) { | |
guard let image = image else {return} | |
UIColor(patternImage: image).setFill() | |
let path = UIBezierPath(rect: rect) | |
path.fill() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment