2

I have passed a [String:AnyObject] as userdata to addToolTipRect..

var myObject = [String:AnyObject]()

self.addToolTipRect( binCoordinates, owner: self, userData: &myObject )

So, in stringForToolTip, I need to convert it back to [String:AnyObject]

var theData = [String:AnyObject](data) does not work.

Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
ericg
  • 8,413
  • 9
  • 43
  • 77

1 Answers1

0
// userData: UnsafeMutablePointer<Void>

let pUserData = UnsafeMutablePointer<Dictionary<String,AnyObject>>(userData)

// you can accsees all properties and functions via

pUserData.memory.myPropery // read or write myObject.myProperty
pUserData.memory.foo()     // execute myObject.foo()
user3441734
  • 16,722
  • 2
  • 40
  • 59