SHARE
TWEET

catGameCircleManager

a guest Feb 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Foundation
  2. import UIKit
  3.  
  4. class CircleManager:NSObject{
  5.     static let shared = CircleManager()
  6.     private override init(){}
  7.    
  8.     var circleSize: CGFloat = 100
  9.     var circleArray: [UIView] = []
  10.    
  11.    
  12.    
  13.     func removeCircle(){
  14.         let circle = circleArray[circleArray.count-1]
  15.         circle.removeFromSuperview()
  16.         circleArray.removeLast()
  17.     }
  18.    
  19.     func changeCircleSize(){
  20.         let randomValue = arc4random_uniform(3)
  21.         switch  randomValue {
  22.         case 0:
  23.             circleSize = 135
  24.         case 1:
  25.             circleSize = 100
  26.         case 2:
  27.             circleSize = 65
  28.         default:
  29.             circleSize = 100
  30.         }
  31.     }
  32.    
  33.     func changeCircleBackgroundColor(_ circle: UIView){
  34.         let randomValue = arc4random_uniform(3)
  35.         switch randomValue {
  36.         case 0:
  37.             circle.backgroundColor = .red
  38.         case 1:
  39.             circle.backgroundColor = .green
  40.         case 2:
  41.             circle.backgroundColor = .blue
  42.         default:
  43.             circle.backgroundColor = .red
  44.         }
  45.     }
  46.    
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top