Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Renders a tiled image in a view. Also renders in the storyboard.
@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
You can’t perform that action at this time.