#Sharing Models Between iOS app and Vapor

1 messages · Page 1 of 1 (latest)

clever ore
#

Is there a tutorial available that would illustrate how to share models between an iOS app and Vapor? I tried a while ago writing a Swift package but found it to be difficult to manage with docker (SSH keys access/setup.) Admittedly, I don’t know if my approach was the right one.

I’d love to revisit this now that I have some available time. If you’re on the same boat, how do you manage it?

slender trout
clever ore
#

Thanks @slender trout !

loud jewelBOT
tidal marsh
#

You can share your DTOs (not Fluent models), which you can abstract into a separate package or something. But depending on what you're building, might be easier to just copy paste them. You can check out my repo for some examples of DTOs https://github.com/petrpavlik/vapor-saas-backend-template

GitHub

A starter template for your SAAS backend using Swift and Vapor - GitHub - petrpavlik/vapor-saas-backend-template: A starter template for your SAAS backend using Swift and Vapor

clever ore
#

I wrote a script to perform one-way copies of the DTOs from Vapor to the client. Works well, though one has to remember to always update the DTOs in Vapor first. Thanks @tidal marsh.