powing
(Albert)
1
As Swift only comes with the N,E,S,W directions on a 2D plane with the UISwipeGestureRecognizer I wanted to add in diagonal directions NE, SE, SW,NW, by subclassing it. I can confirm that the swipe gestures will accept diagonal co-ordinates simply combining -100 on the x and y will move a node in a NW direction, but there is no direction for it in the UISwipeGestureRecognizer class.
However, I am confused as to what I need to do to achieve this, even if I need to subclass or use an extension?
extension UISwipeGestureRecognizer {
public struct Direction : OptionSet {
public init(rawValue: UInt)
public static var right: UISwipeGestureRecognizer.Direction { get }
public static var left: UISwipeGestureRecognizer.Direction { get }
public static var up: UISwipeGestureRecognizer.Direction { get }
public static var down: UISwipeGestureRecognizer.Direction { get }
}
}
I can't find any examples online for extending the ability of the class, is it not wise?