Conditionalising function declaration on OS version

I have found a potentially feasible solution using associatedtype :

Solution