How can I make touch input work on my IPhone?

All I want is when I tap anywhere on my IPhone screen, to set didjump = true; I have looked at and tried so many tutorials about touch input but none of them worked. I just need a little help out with this and I have been trying for months so please don’t link a tutorial, I have probably already seen it. Please respond with c# code. Thanks for your time.

if (Input.touchCount > 0){
if (Input.GetTouch(0).phase == TouchPhase.Began){
didJump = true;
Debug.Log(“Jumped”); //Just checks if all when well.

This code means that if you are touching the screen with more than 0 fingers and your touch just began, then set didJump to true.

Make sure that this code is in the Update() function.