How can I know USB is connected or not?

While (! Serial){};

Seeeduino XIAO could not determine if there is a USB connection using the above syntax.
Do you know how to determine USB is connected or not?