Created
June 28, 2018 10:35
-
-
Save tiagomartinho/d1acb79eb038c98aaa7e83703b4a4c6a to your computer and use it in GitHub Desktop.
This file contains 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
let location = gestureRecognizer.location(in: view) | |
let circleView = UIView() | |
let colors = [#colorLiteral(red: 0.4745098054, green: 0.8392156959, blue: 0.9764705896, alpha: 1),#colorLiteral(red: 0.5568627715, green: 0.3529411852, blue: 0.9686274529, alpha: 1),#colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1),#colorLiteral(red: 0.9568627477, green: 0.6588235497, blue: 0.5450980663, alpha: 1),#colorLiteral(red: 0.9764705896, green: 0.850980401, blue: 0.5490196347, alpha: 1),#colorLiteral(red: 0.721568644, green: 0.8862745166, blue: 0.5921568871, alpha: 1)] | |
circleView.backgroundColor = colors[Int(arc4random_uniform(UInt32(colors.count)))].withAlphaComponent(0.8) | |
let size: CGFloat = 200 | |
circleView.frame = CGRect(x: location.x, y: location.y, width: size, height: size).offsetBy(dx: -size/2, dy: -size/2) | |
circleView.layer.cornerRadius = size / 2 | |
view.addSubview(circleView) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment