Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- import UIKit
- class CircleManager:NSObject{
- static let shared = CircleManager()
- private override init(){}
- var circleSize: CGFloat = 100
- var circleArray: [UIView] = []
- func removeCircle(){
- let circle = circleArray[circleArray.count-1]
- circle.removeFromSuperview()
- circleArray.removeLast()
- }
- func changeCircleSize(){
- let randomValue = arc4random_uniform(3)
- switch randomValue {
- case 0:
- circleSize = 135
- case 1:
- circleSize = 100
- case 2:
- circleSize = 65
- default:
- circleSize = 100
- }
- }
- func changeCircleBackgroundColor(_ circle: UIView){
- let randomValue = arc4random_uniform(3)
- switch randomValue {
- case 0:
- circle.backgroundColor = .red
- case 1:
- circle.backgroundColor = .green
- case 2:
- circle.backgroundColor = .blue
- default:
- circle.backgroundColor = .red
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement