Objc bindings and gesture recognition

This creates a draggable UIView, with some issues:

– Objc Views

function setup()
–watch variables to be set during gesture recognition
parameter.watch(“touchOnDragView”)
parameter.watch(“touchOnIOSScreen”)

--make the view to drag
dvFrame = {
    x = WIDTH/2, 
    y = HEIGHT/2, 
    width = 400, 
    height = 400
}
dragView = objc.UIView()
--objective-c y zero is the top of the screen, the opposite of Codea 
dragView.frame = objc.rect(dvFrame.x, HEIGHT - dvFrame.y - dvFrame.height, dvFrame.width, dvFrame.height)
dragView.backgroundColor = color(225, 188, 215)

--add view to screen view
objc.viewer.view:addSubview_(dragView)

--make object to recieve updates from the gesture recognizer
local GestureHandler = objc.class("GestureHandler")
function GestureHandler:dragDragView_(sender)
    --get touch x, y relative to screen and to view
    local screenLoc = dragRecognizer:locationInView_()
    local viewLoc = dragRecognizer:locationInView_(dragView)
    --update the variables for the watch parameters
    touchOnDragView = vec2(viewLoc.x, viewLoc.y)
    touchOnIOSScreen = vec2(screenLoc.x, screenLoc.y)
    --calculate correct place for the new x, y
    local adjX = math.floor(math.abs(screenLoc.x + viewLoc.x))
    local adjY = math.floor(math.abs(screenLoc.y + viewLoc.y))
    --update frame
    dragView.frame = objc.rect(adjX, adjY, dvFrame.width, dvFrame.height)
end
local gHandler = GestureHandler()

--make gesture recognizer and setup object to receive updates
dragRecognizer = objc.UIPanGestureRecognizer()
dragRecognizer:addTarget_action_(gHandler, objc.selector("dragDragView:"))
dragView:addGestureRecognizer_(dragRecognizer)

end

function draw()
background(224, 220, 183)
end

Issue 1: the view pops around on the screen as you drag it.
Issue 2: drag it for long enough and Codea crashes

@jfperusse can you give guidance? Are these fixable, or is it just never a good idea to mix iOS touch-processing with Codea?