Help with Camera touch script

Hello !
I need help with my camera touch script.
I want to make a fps camera controller for mobile when you swipe left camera turns right and when you swipe right camera turns left and when you swipe down camera goes up and when you swipe up camera goes down like many fps games.
I have code but it’s not fully working and it is not smooth so can someone more experienced help me :slight_smile:

using UnityEngine;

public class TouchCamera : MonoBehaviour
{
    private float turningSpeed = 0.5f;
    private Vector2 touchPosition;

    private void Start()
    {
    }

    private void Update()
    {
        if (Input.touchCount > 0)
        {
            var transformCam = transform;
           
            if (Input.GetTouch(0).position.x > touchPosition.x)//rotate left
            {
                transform.Rotate(new Vector3(transform.rotation.x, transform.rotation.y - turningSpeed, transform.rotation.z));
            }else if (Input.GetTouch(0).position.x < touchPosition.x)//rotate right
            {
                transform.Rotate(new Vector3(transform.rotation.x, transform.rotation.y + turningSpeed, transform.rotation.z));
            }
            if (Input.GetTouch(0).position.y > touchPosition.y)//rotate up
            {
                transform.Rotate(new Vector3(transform.rotation.x + turningSpeed, transform.rotation.y, transform.rotation.z));
            }else if (Input.GetTouch(0).position.y < touchPosition.y)//rotate down
            {
                transform.Rotate(new Vector3(transform.rotation.x - turningSpeed, transform.rotation.y, transform.rotation.z));
            }

            touchPosition = Input.GetTouch(0).position;

        }

Please help