If you have a property theConnection as URLconnection (introduced in Xojo 2018 R4) but you need the code to be compatible with older versions, then what is the recommended way of doing it?
After all you can’t make the type conditional as far as I know, and making it a variant requires casting everywhere. Is there a more elegant way of doing it?
welcome to the hell that API 2 brings
you could try setting those properties compatibility flags OFF saving and seeing if the older versions preserve that (and obey it)
but then your users have to be aware of how to turn that back on at some point
the other option is
they all suck
If it’s only URLConnection you are worried about, I would suggest a wrapper class .
Under the hood used HTTPSecureSocket or URLConnenction using #If XojoVersion in code. That way it could compile or run in any Xojo version.
you still cant define a property unless its a variant
its a mess Xojo could have avoided but didnt
HA! Have been out looking at houses all day (Auckland is a nightmare) and on the way back thought about a wrapper … seems I do make some progress after all …
If you have the MBS plugins use CURLSMBS instead as it works so much better.
A wrapper is not a general solution for properties… in this case it is about creating a class with a potentially unique API (or one that matches either class) that translates the properties as needed under the hood to use either URLConnection or HTPPSecureSocket to make it Xojo version agnostic.