Consider this first-order initial value problem:
$$\begin{cases} y'=1-x+y^2-xy^2\\ y(0)=1 \end{cases}$$
I've tried simplifying the right-hand side to $(y^2+1)(-x+1)$ and then integrating it.
I obtained a general solution as a tangent function but it seems that this is not the answer.
Your general solution is right. $$y = \tan\left(x-\dfrac{x^2}2+c\right)$$ Satisfying $(0,1)$, we get, $$1=\tan c\implies c=n\pi+\dfrac\pi4\\ \implies y=\tan\left(x-\dfrac{x^2}2+n\pi+\dfrac\pi4\right)\\ =\tan\left(x-\dfrac{x^2}2+\dfrac\pi4\right)$$ To verify, we differentiate both sides, $$\implies y' = \sec^2\left(x-\dfrac{x^2}2+\dfrac\pi4\right)(1-x)$$ (by chain rule) $$\implies y' = \left(1+\tan^2\left(x-\dfrac{x^2}2+\dfrac\pi4\right)\right)(1-x)\\ =(1+y^2)(1-x)$$ which is the desired original differential equation.