added swift templates + fixed some issues with the tojsonstring