If $A$ and $\bar{X}$ are independent, then so are $S^2$ and $\bar{X}$ independent

I have a question about a question in the following link: Proof of the independence of the sample mean and sample variance Here $( X_{2}-\bar{X},X_{3}-\bar{X},\cdots,X_{n}-\bar{X}) =A$, $S^2$ the estimator of the variance and $X_1,...,X_n$ are i.i.d. $N(\mu, \sigma)$. In the link it says that if $A$ and $\bar{X}$ are independent, then so are $S^2$ and $\bar{X}$. I've thought about this very long but I can't find out why. I need help. Thanks.

In general, if $X, Y_1,Y_2,\ldots,Y_n$ are independent random variables, then so are $X$ and $g(Y_1,Y_2,\ldots,Y_n)$ for any (measurable) function $g$. Apply this to your question after noting that $S^2$ is a function of the $n$ random variables $X_i−\bar{X}$. See also this answer.
The harder part of problem is in first proving that $A$ and $\bar{X}$ are independent random variables, which is true for i.i.d. normal random variables $X_i$ but not necessarily true for other distributions.