Renaming figures and tables in appendices in LaTeX

I have trouble remembering how to reset the counters for tables and figures in LaTeX. This chunk resets the figure/table numbers and adds an S in front of them (as in Figure S1). Chunk taken from:


Then, when your supplement starts, just add the line: