Tap and Drag detected

Hi my question is very simple, i want to know how to execute a part of code depending if the user touch or swipe the same element, i got this code but it runs both the swipe code and the tap code at the same time, and I just want it to make just one thing.

if(Input.touchCount==1)
{
	if (touch.phase == TouchPhase.Ended && touch.tapCount>1)
	{
		if(hited())
		{
			//single tap
		}
    }
    else
    { 
        if (touch.phase == TouchPhase.Moved)
	    {
            //draging/swipe
        }
    }
}

the hited method just detects if the object was touched by Raycasting

here this code it’s works with me

  private Vector2 startTouch,   swipeDelta;
  private bool tap,  swipe,   isDraging = false; 

void Update()
{
    CeckSwipeOrTap();
}

 void CeckSwipeOrTap()
    {
        tap = false;

        if (Input.touches.Length != 0)
        {
            if (Input.touches[0].phase == TouchPhase.Began)
            {
                isDraging = true;
                startTouch = Input.touches[0].position;
            }
            else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
            {
                swipeDelta = (Vector2)Input.mousePosition - startTouch;
                if (swipeDelta.magnitude > 25)  // distance to swipe
                {
                    swipe = true;    //draging / swipe
                }
                else
                {
                    tap = true;      //tap
                }

                Rest();
            }
        }
        swipeDelta = Vector2.zero;
    }

  void Rest()
    {
        startTouch = swipeDelta = Vector2.zero;
        isDraging = false;
    }