Rotate Sprite slowly

Hello,
I am currently trying to create a geometry dash clone and have a problem with the rotation of the jump. i would like my player to rotate 180 degrees like in the original. currently he only does it very abruptly. in the attached code you can see a simple push button rotation but i want it to rotate slowly. Can somebody help me with it? (Sorry for the Bad English)

void Update()
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
            float y = transform.position.y;
            StartCoroutine(jump(y));

            transform.Rotate(0, 0, -180);
        }
    }

float rotateSpeed = 90f;
Quaternion dest = Quaternion.Euler(0f, 0f, -180f);
void Update()
{
transform.rotation = Quaternion.RotateTowards(transform.rotation, dest, rotateSpeed * Time.deltaTime);
}

It might help you to rotate the gameobject slowly.

However, if you change transform.Rotate(0, 0, -180) to transform.rotation = Quaternion~~~~,
rotation will not go to the dest because rotation part is called just once (when you press down space key)

So I made another script for rotation and make it like this.

I know this code is not that clean, but this is my approach to help you.

I hope other people give you better solution.

(images attached)