launchctl in Swift using Cocoa, XCode 10.1

We have an inhouse application to automate some of the network parameters, however we need to occasionally stop the software from functioning. Normally this would be done using launchctl to unload the LaunchDaemon's which the software uses.

I've created a menu bar application which gives two options, one to start and the other to stop this software, but I am having issues running scripts with administrator privileges.

Is there a way to use the launchctl command within swift to load and unload the daemons, and in doing so when the "stop" button is pressed, to prompt for user password?

Is there a way to use the launchctl command within swift to load and unload the daemons

Sure

and in doing so when the "stop" button is pressed, to prompt for user password?

Maybe, but I don't like where this is headed...

I am having issues running scripts with administrator privileges. 

Maybe you should have lead with that. What issues are you having?

If this is an in-house application, you have a whole world of possible solutions. Just pick the easiest and be done with it. However, you might want to take a step back and review how to configure these network parameters. I strongly suspect that you are taking the long way around.
launchctl in Swift using Cocoa, XCode 10.1
 
 
Q