How to run commands in swift language application

HI,

I want to know whether my extension is in active state or not as part of my swift application.

It would get this on terminal usingsystemextensionsctl list | grep FilterExtension | grep activated command. It can be possible with system() on C++ as system("systemextensionsctl list | grep FilterExtension | grep activated")

But how can I achieve this in swift language?

Help me.
Thanks.