I know that the following claim is not true: if a sequence of continuous functions converging pointwise to a continuous function then the convergence is uniform. A counterexample is given here: Does pointwise convergence of continuous functions on a compact set to a continuous limit imply uniform convergence on that set?
Somehow I have "proved" the claim, so I know I have made a mistake somewhere.
My attempt
Let $S$ be a compact set. Let $f_n : S \rightarrow \mathbb R$ be a sequence of continuous functions converging pointwise to $f: S \rightarrow \mathbb R$ which is also continuous.
$f_n$ and $f$ are defined on a compact set and so are also uniformly continuous.
Since $S$ is compact, we can cover $S$ with a finite number of open balls, $S_i$ of size $\delta > 0$. So, the uniform deviation can be decomposed as:
$$\sup_{x \in S} |f_n(x) - f(x)| = \max_i \sup_{x \in S_i} |f_n(x) - f(x)| = \max_i \sup_{x \in S_i} |f_n(x) - f_n(x_i) +f_n(x_i) - f(x_i) + f(x_i) - f(x)|$$
where $x_i \in S_i$ are the centers of the balls $S_i$. Then, applying the triangle inequality:
$$\leq \max_i \sup_{x \in S_i} \underbrace{|f_n(x) - f_n(x_i)|}_{(A)} + \underbrace{|f(x_i) - f(x)|}_{(B)} + |f_n(x_i) - f(x_i)|$$
Since $f$ and $f_n$ are both uniformly continuous, the first and second term can be made arbitrarily small uniformly over $x$ as $\delta \rightarrow 0$. The last term also goes to $0$ since it is independent of $x$ and the $\max$ is taken over a finite set.
What I think my mistake was
I think I am using the uniform continuity hypothesis incorrectly. I guess what I am applying here is actually equicontinuity of the collection $\{f_n\}$. Am I correct that this is the error in the proof? Is that the only mistake?
EDIT:
I'm not sure that I'm implicitly using an equicontinuity hypothesis here. More explicitly, I $(A)$ and $(B)$ above do not necessarily go to $0$ since it's not clear how the $\max$ over the open cover $\{S_i\}$ behaves as $\delta \rightarrow 0$.
Consider the "spike" function suggested in the linked post above which is $0$ everywhere except for a continuous peak of height $1$ at $1/n$ with width $1/n$. While this function is uniformly continuous and converges pointwise to the uniformly continuous function $0$ on $[0, 1]$, the convergence is not uniform. Moreover, the quantity $(A)$ above is always $1$, showing that the "proof" in the question here is not correct.