Image for post
Image for post

Enums are a powerful language feature of Swift. They are more than a type-safe way of defining different states. But in this article, we’ll concentrate on the basic enum functionality in Swift and we’ll integrate them in a GraphQL API server which is based on Vapor. If you are new to GraphQL in combination with Vapor, I recommend reading my previous article where I go through the steps on how to build a GraphQL server with Swift and Vapor.

This Article can also be read on my personal blog: https://alexsteiner.de/blog/posts/graphql-with-vapor-part-2/

In this article, we’ll extend the todo API example. Therefore we use a GraphQL Vapor template as a starting point. We want to build the feature of marking a todo as done or moving it to a “for later” list. To represent the different states of a todo we make use of enums. We’ll save this state property with the rest of the information in a database and make them available through an extension to the GraphQL API that is already in place. …


Image for post
Image for post

GraphQL is a query language for APIs developed by Facebook but open sourced in 2015. It is an alternative to REST-based APIs because it allows clients to decide which data they need instead of the server upfront deciding which data is delivered on each endpoint. It is a modern way of querying data, for example, some big companies next to Facebook like GitHub or Shopify have seen the advantages and implemented their APIs with GraphQL.

This Article can also be read on my personal blog: https://alexsteiner.de/blog/posts/graphql-with-vapor-part-1/

If you want to learn more about GraphQL go and check out their website. …


Image for post
Image for post

While building server-side Swift code you probably come along the requirement of sending an email to users. Let it be a confirmation, newsletter signup or a notification message. So we need some kind of email sending possibility. There are a lot of different email services to pick from when speaking about server-side development. (I have good experiences with https://github.com/LiveUI/MailCore but there are other options to pick from). But the advantages and disadvantages of different packages will not be further discussed in this article.

This Article can also be read on my personal blog: https://alexsteiner.de/blog/posts/email-content-dsl/

While sending emails it is possible to style them with HTML but also to include a text-based version. This helps email clients to choose what to display to our users. …

About

Alexander Steiner

Server Side Swift developer with background in iOS and web development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store