0

I was wondering if it was possible to run commands we normally do on Terminal such as "Heroku run rake (script)" or "Heroku Create" on Swift (Xcode) when the user presses a button. Is there some type of Heroku API or SDK that I can include in my project?

Sorry, I am fairly new with Heroku and Swift.

Thank you in advance!

max pleaner
  • 26,189
  • 9
  • 66
  • 118
Machilles
  • 13
  • 4
  • 1
    Do you just want to call Heroku command on Xcode? Or you need to do it in the Swift language? (The latter, I mean if you need to do it in a mac App written in Swift or not.) – OOPer Aug 11 '17 at 21:36
  • 1
    Possible duplicate of [How do I run an terminal command in a swift script? (e.g. xcodebuild)](https://stackoverflow.com/questions/26971240/how-do-i-run-an-terminal-command-in-a-swift-script-e-g-xcodebuild) – max pleaner Aug 11 '17 at 21:37
  • I want to run a Heroku command ("Heroku run rake (script)") when the user presses a button on my iOS app. Sorry for not clarifying earlier. – Machilles Aug 11 '17 at 21:43
  • 2
    **_on my iOS app_** Hardly possible. You cannot call arbitrary binary command from your iOS app, and you cannot install Heroku tools into iOS devices. You need to integrate Heroku command into your app itself. It's hardly possible. – OOPer Aug 11 '17 at 21:48
  • 1
    With a glance to Heroku APIs, you may have a chance to implement the same functionality of some Heroku commands with some APIs combined. But it's beyond my knowledge and hard to say what APIs to use for "Heroku run rake (script)" or "Heroku Create". (Also Heroku command may be using private APIs.) So, you'd better concentrate on how to use Heroku APIs, rather than using Heroku command from iOS app. – OOPer Aug 11 '17 at 22:25

1 Answers1

0

Heroku does have a REST API available, but no obvious support for interacting with it through swift (or Objective-C). Java, Node.js, Python, Ruby, etc are listed there with language references.

You would need to create your own REST client to interact with it. Once you have that in place you should be able to invoke changes from there. So it's possible, but a fair bit of work will be involved to do it.

heckj
  • 7,136
  • 3
  • 39
  • 50