swiftserver-sidevaporkitura

Use UIKit with Vapor or Kitura


I have developed an iOS App and would like to create a web API with some parts of my code. This API will send an UIImage generated from a UIView. The problem I have with Vapor is that I only managed to use AppKit, not UIKit. Certainly because the Xcode project with Vapor is a MacOS project. Is there a way to use UIKit or iOS Swift code with Vapor or any other solutions like Kitura ???

Thanks for your help :)

Regards,


Solution

  • If you want your Backend API Server (Vapor or Kitura) to run in a hosted environment, it will need to be able to run on Linux - where only Foundation is supported.

    You can still transfer UIImages between iOS app and server, but you'll need to convert the UIImage to Data first (using something like UIImage.jpegData())

    You can see an example of this in the "FoodTrackerBackend" tutorial for Kitura here: https://github.com/IBM/FoodTrackerBackend