     public override func willMoveToSuperview(newSuperview: UIView!) {
 
         superview?.removeObserver(self, forKeyPath: contentOffsetKeyPath, context: &KVOContext)
-        if (newSuperview != nil && newSuperview.isKindOfClass(UIScrollView)) {
-            newSuperview.addObserver(self, forKeyPath: contentOffsetKeyPath, options: .Initial, context: &KVOContext)
-            scrollViewBouncesDefaultValue = (newSuperview as! UIScrollView).bounces
-            scrollViewInsetsDefaultValue = (newSuperview as! UIScrollView).contentInset
+        if let scrollView = newSuperview as? UIScrollView {
+            scrollView.addObserver(self, forKeyPath: contentOffsetKeyPath, options: .Initial, context: &KVOContext)
+            scrollViewBouncesDefaultValue = scrollView.bounces
+            scrollViewInsetsDefaultValue = scrollView.contentInset
         }
     }
     

                        labelTitle.text = NSLocalizedString("Pull to refresh", comment: "Refresher")
                        animator.changeProgress(-offsetWithoutInsets / self.frame.size.height)
                    }
                    previousOffset = scrollView!.contentOffset.y
                }
            }
        } else {

            scrollView.contentInset = insets
            scrollView.contentOffset = CGPointMake(scrollView.contentOffset.x, -insets.top)
        }, completion: {finished in
            self.animator.startAnimation()
            self.action()
        })
    }
    
