Look at the demo. The comments and the code should be enough to understand.can you explain a little bit more about this feature?
To access the collision editor in Tiled, you have to edit the tileset, select a tile and click on the button with a circle mixed with a rectangle.