SWIFT: As a backend?

Discussion in 'Mac Programming' started by AdonisSMU, Jun 9, 2014.

  1. AdonisSMU macrumors 603

    Joined:
    Oct 23, 2010
    #1
    Are there any plans to use SWIFT as a backend technology rather than just a FE technology? The reason I say this is because C# and .net being used on the backend probably significantly helped with its adoption.
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    If the backend is OS X, I don't see why not.

    One problem with Swift is it's currently an Apple-only language. If/when that changes, then Swift will work on more backends. Otherwise it won't. Simple as that.
     
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    ...

    C# doesn't seem like a particularly popular language:

    http://blog.codeeval.com/codeevalblog/2014#.U5YTJBakAeI
    https://github.com/blog/99-popular-languages
    http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

    So I don't think I'd base decisions on how to proceed with the language based on what C# does. Mimicking C, Java, or Python might be a good idea (and Python is often used as a backend).
     
  4. Ap0ks macrumors 6502

    Joined:
    Aug 12, 2008
    Location:
    Cambridge, UK
    #4
    You're kidding right? C# is one of the most popular languages in the Windows world. The first two links are too biased to open-source friendly languages so don't give an accurate picture whereas the third link shows C# right alongside C & C++ so not sure what makes you say it's not popular.
     
  5. AdonisSMU thread starter macrumors 603

    Joined:
    Oct 23, 2010
    #5
    C# is very popular and many devs use it. That's why I brought it up. TIOBE Index has C#(#5) listed right behind C++(#4). Apple could put a dent in the PHP, Python, Java backends by making SWIFT accessible in this way as well. Or maybe a enterprising developer needs to build the capability to have a SWIFT web server.
     
  6. Ap0ks, Jun 9, 2014
    Last edited: Jun 9, 2014

    Ap0ks macrumors 6502

    Joined:
    Aug 12, 2008
    Location:
    Cambridge, UK
    #6
    As far as I'm aware there's nothing stopping you from using Swift to create a backend server, the only issue is that at present it'll need to be run on OS X which isn't a hugely popular server OS.

    I don't think the popularity of C# has increased because it can be used in the backend and the frontend, but more because people loathe Visual Basic and Microsoft have really pushed the use of C# in their technologies like .Net. It's all about the ecosystem really, Apple don't need to be more popular than any other language as long as they have developers creating apps for iOS & Mac OS using Swift. CloudKit should cover things for the majority of basic backends and other developers will just use a tool best suited to the task.
     
  7. AdonisSMU thread starter macrumors 603

    Joined:
    Oct 23, 2010
    #7
    Gotta start from somewhere... People managed to make a crappy Java backend surely SWIFT devs can make a SWIFT backend.
     
  8. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #8
    If all you want to do is run web applications written in Swift then it is pretty easy to do. Just write a FastCGI or SCGI server in Swift and run Nginx as your HTTP server connecting to the Swift backend.

    You could write an SCGI server for Swift in no time at all if you really wanted too. Here's the spec to get you started.

    http://www.python.ca/scgi/protocol.txt

    Nginx supports SCGI and FastCGI out of the box so really its not a big issue. The bigger issue that you don't seem to have considered is the Swift API for accessing a database server. You'd likely want to take the C API for PostgreSQL (or perhaps MySQL if you are really masochistic) and then writing a Swift wrapper for it. That might well take a little longer but to get something simple to work with it shouldn't take that long.

    And that is all you really need to write backends in Swift.
     
  9. mozumder macrumors 6502a

    Joined:
    Mar 9, 2009
    #9
    i could use a version of Django written in Swift, interaction with Final Cut Pro X exporting and Aperture's Raw conversion capabilities...
     

Share This Page