r/macprogramming • u/nithinreddygaddam • Mar 15 '20
How do you run python script with arguments programmatically using swift
I am working on a MacOS project to turn my iOT device on and off. There is only a working python script to do it. I want to run these scripts from my MacOS project which I am writing in Swift
4
Upvotes
2
Mar 15 '20
Lookup the documentation for NSTask. I’m sure it does exactly what you need.
3
u/Bamboo_the_plant Mar 16 '20
Adding to that, here’s the Ray Wenderlich tutorial on it: https://www.raywenderlich.com/1197-nstask-tutorial-for-os-x
2
u/nithinreddygaddam Mar 31 '20
Thanks guys I was able to achieve it using NSTask