     // Need to implement that, because otherwise it can't find
     // the constructor init(layer:AnyObject!)
     // Doesn't seem to look in the super class
-    override init(layer: AnyObject) {
+    override init(layer: Any) {
         super.init(layer: layer)
     }
     
     init(repeatCount: Float=Float.infinity, radius: CGFloat, position: CGPoint) {
         super.init()
-        self.contentsScale = UIScreen.mainScreen().scale
+        self.contentsScale = UIScreen.main.scale
         self.opacity = 0.0
-        self.backgroundColor = UIColor.blueColor().CGColor
+        self.backgroundColor = UIColor.blue.cgColor
         self.radius = radius;
         self.repetitions = repeatCount;
         self.position = position
-        
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), {
+
+        DispatchQueue.global(qos: .background).async {
             self.setupAnimationGroup()
-            self.setPulseRadius(self.radius)
+            self.setPulseRadius(radius: self.radius)
             
             if (self.pulseInterval != Double.infinity) {
-                dispatch_async(dispatch_get_main_queue(), {
-                    self.addAnimation(self.animationGroup, forKey: "pulse")
-                })
+                DispatchQueue.main.async {
+                    self.add(self.animationGroup, forKey: "pulse")
+                }
             }
-        })
+        }
     }
 
     required init(coder aDecoder: NSCoder) {

    var fromValueForRadius:     Float = 0.0
    var fromValueForAlpha:      Float = 0.45
    var keyTimeForHalfOpacity:  Float = 0.2
    var animationDuration:      NSTimeInterval = 3.0
    var pulseInterval:          NSTimeInterval = 0.0
    var useTimingFunction:      Bool = true
    var animationGroup:         CAAnimationGroup = CAAnimationGroup()
    var repetitions:            Float = Float.infinity

        let opacityAnimation = CAKeyframeAnimation(keyPath: "opacity")
        opacityAnimation.duration = self.animationDuration
        opacityAnimation.values = [self.fromValueForAlpha, 0.8, 0]
        opacityAnimation.keyTimes = [0, self.keyTimeForHalfOpacity as NSNumber, 1]
        opacityAnimation.isRemovedOnCompletion = false
        
        return opacityAnimation
    }
    
}