         }
     }
     
-    static func removeGesture(gesture: UITapGestureRecognizer, listener:(gestureRecognizer: UITapGestureRecognizer) -> () ) {
-        var gestureListeners = tapListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.tapListeners = gestureListeners
-    }
-    
-    static func removeGesture(gesture: UIPanGestureRecognizer, listener:(gestureRecognizer: UIPanGestureRecognizer) -> () ) {
-        var gestureListeners = panListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.panListeners = gestureListeners
-    }
-    
-    static func removeGesture(gesture: UISwipeGestureRecognizer, listener:(gestureRecognizer: UISwipeGestureRecognizer) -> () ) {
-        var gestureListeners = swipeListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.swipeListeners = gestureListeners
-    }
-    
-    static func removeGesture(gesture: UIPinchGestureRecognizer, listener:(gestureRecognizer: UIPinchGestureRecognizer) -> () ) {
-        var gestureListeners = pinchListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.pinchListeners = gestureListeners
-    }
-    
-    static func removeGesture(gesture: UIRotationGestureRecognizer, listener:(gestureRecognizer: UIRotationGestureRecognizer) -> () ) {
-        var gestureListeners = rotationListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.rotationListeners = gestureListeners
-    }
-    
-    static func removeGesture(gesture: UILongPressGestureRecognizer, listener:(gestureRecognizer: UILongPressGestureRecognizer) -> () ) {
-        var gestureListeners = longPressListeners
-        WeakCollections.clean(&gestureListeners)
-        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
-            var lists = gestureListeners[gestureKey]!
-            var indexForRemove = -1
-            for (index, list) in enumerate(lists) {
-                if list === listener {
-                    indexForRemove = index
-                }
-            }
-            if indexForRemove > -1 {
-                let f = lists.removeAtIndex(indexForRemove)
-                gestureListeners[gestureKey] = lists
-            }
-        }
-        self.longPressListeners = gestureListeners
-    }
-    
     public static dynamic func handleGesture(gesture: UIGestureRecognizer) {
         println("handle gesture")
-        if gesture is UITapGestureRecognizer {
-            println("have tap gesture")
-            println(tapListeners.count)
-            let gest = gesture as! UITapGestureRecognizer
+        if let gest = gesture as? UITapGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: tapListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)
                 }
             }
-        } else if gesture is UIPinchGestureRecognizer {
-            let gest = gesture as! UIPinchGestureRecognizer
+        } else if let gest = gesture as? UIPinchGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: pinchListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)
                 }
             }
-        } else if gesture is UILongPressGestureRecognizer {
-            let gest = gesture as! UILongPressGestureRecognizer
+        } else if let gest = gesture as? UILongPressGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: longPressListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)
                 }
             }
-        } else if gesture is UIPanGestureRecognizer {
-            let gest = gesture as! UIPanGestureRecognizer
+        } else if let gest = gesture as? UIPanGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: panListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)
                 }
             }
-        } else if gesture is UIRotationGestureRecognizer {
-            let gest = gesture as! UIRotationGestureRecognizer
+        } else if let gest = gesture as? UIRotationGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: rotationListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)
                 }
             }
-        } else if gesture is UISwipeGestureRecognizer {
-            let gest = gesture as! UISwipeGestureRecognizer
+        } else if let gest = gesture as? UISwipeGestureRecognizer {
             if let lists = WeakCollections.valueForWeakKey(gest, dict: swipeListeners) {
                 for f in lists {
                     f(gestureRecognizer: gest)

public extension UIGestureRecognizer {
    public convenience init(_ listener:(gestureRecognizer: UIGestureRecognizer) -> () ) {
        self.init(target: ArkUI.self, action: "handleGesture:")
        ArkUI.addGesture(self, listener: listener)
    }
    public func onGesture(listener:(gestureRecognizer: UIGestureRecognizer) -> () ) {
        ArkUI.addGesture(self, listener: listener)
    }
    public func addListener(listener:(gestureRecognizer: UIGestureRecognizer) -> () ) {
        ArkUI.addGesture(self, listener: listener)
    }
    public func removeListener(listener:(gestureRecognizer: UIGestureRecognizer) -> () ) {
        ArkUI.removeGesture(self, listener: listener)
    }
}

public extension UITapGestureRecognizer {
    public convenience init(_ listener:(gestureRecognizer: UITapGestureRecognizer) -> () ) {
        self.init(target: ArkUI.self, action: "handleGesture:")
        ArkUI.addGesture(self, listener: listener)
    }
    public override func onGesture(listener:(gestureRecognizer: UITapGestureRecognizer) -> () ) {
        ArkUI.addGesture(self, listener: listener)
    }
    public override func addListener(listener:(gestureRecognizer: UITapGestureRecognizer) -> () ) {
        ArkUI.addGesture(self, listener: listener)
    }
    public override func removeListener(listener:(gestureRecognizer: UITapGestureRecognizer) -> () ) {
        ArkUI.removeGesture(self, listener: listener)
    }

}

    static var swipeListeners = Dictionary<WeakKey<UISwipeGestureRecognizer>,Array<(gestureRecognizer: UISwipeGestureRecognizer) -> ()>>()
    static var tapListeners = Dictionary<WeakKey<UITapGestureRecognizer>,Array<(gestureRecognizer: UITapGestureRecognizer) -> ()>>()
    
    static func addGesture<T: UIGestureRecognizer>(gesture: T, listener: (gestureRecognizer: T) -> (),inout gestureListeners: Dictionary<WeakKey<T>,Array<(gestureRecognizer: T) -> ()>> ) {
        WeakCollections.clean(&gestureListeners)
        let gestureKey = WeakCollections.weakKeyOrNew(gesture, dict: gestureListeners)
        var listenersForKey = gestureListeners[gestureKey]
        if listenersForKey == nil {
            listenersForKey = Array<(gestureRecognizer: T) -> ()>()
            gestureListeners[gestureKey] = listenersForKey
        }
        listenersForKey!.append(listener)
        gestureListeners[gestureKey] = listenersForKey
    }

    static func removeGesture<T: UIGestureRecognizer>(gesture: T, listener:(gestureRecognizer: T) -> (),inout gestureListeners: Dictionary<WeakKey<T>,Array<(gestureRecognizer: T) -> ()>> ) {
        WeakCollections.clean(&gestureListeners)
        if let gestureKey = WeakCollections.weakKey(gesture, dictionary: gestureListeners) {
            var lists = gestureListeners[gestureKey]!
