9

So I have this idea. Please keep in mind that I don't know much about this so if this is too ambitious, I'm sorry. Basically, I want to run a Swift "app" on a Raspberry Pi connected to a monitor. I know how to code an iOS app and I have a few on the App Store, but this is a whole new project I've been thinking about. How would I go about accomplishing this? I've looked on the web for tutorials but none of them are showing how to run actual visual Swift code on a monitor. Most of them are showing how to switch on an LED light or something like that. I don't want to do that. I want to run Swift code (preferably via Xcode) with storyboards and UIViewControllers and all of that stuff on a Raspberry Pi connected to a monitor. Are there any ideas or tutorials anyone knows of? Please keep in mind that I am very new to Raspberry Pi. My only experience is with coding iOS apps with Xcode.

Jacob Cavin
  • 2,169
  • 3
  • 19
  • 47
  • 2
    You can try using https://github.com/PureSwift/Cacao – Alexander Dec 17 '18 at 03:58
  • 2
    I had the same problem too and I got swift working on my Rapsberry :) I found that awesome libary: https://github.com/uraimo/buildSwiftOnARM just follow the README.md and you are able to use even external Libaries in swift and you can control your GPIO with Swift code! As I said it worked for me, i am able to run swift code at my raspberry pi with this libary :) – Jonathan Dec 17 '18 at 06:23
  • @Jonathan I'm sorry it took me so long to respond! I didn't see your response! I don't quite understand how to use this with a raspberry pi. I'm very new to Raspberry Pi. As I have said, my only experience is with coding iOS apps. – Jacob Cavin Jan 10 '19 at 15:10
  • 1
    What you need to do is to build Swift for the Pi, you can follow @Jonathan link for that, the next step is to write your Swift code using a text editor as you can't run Xcode, after that you can execute Swift code from the command line using `swift swift_file_name.swift` – Mosbah Jan 10 '19 at 15:25
  • @JacobCavin you actually don't need experience! In the `README.md` file everything is clearly described. – Jonathan Jan 11 '19 at 09:21
  • @JacobCavin If you still don't understand what to do, could you describe what you don't understand – Jonathan Jan 11 '19 at 09:23

1 Answers1

4

First, for implementing swift on the raspberry pi code with Xcode, I will recommend you to read this: https://www.uraimo.com/2016/12/30/Swift-3-0-2-for-raspberrypi-zero-1-2-3/

and they have good suggestions here: https://forum.openframeworks.cc/t/xcode-osx-and-raspberry-pi/15834/4

As well as, you can read a related article in the part You may also like:

If you need to learn from scratch, I will recommend you to start with swift on the raspberry pi here : https://medium.com/@MissionKao/how-to-compile-swift-on-raspberry-pi-ae33e417a61e https://github.com/keybuk/SignalBox/wiki/Swift-on-Raspberry-Pi

I_Al-thamary
  • 3,385
  • 2
  • 24
  • 37