what’s the recommended way to do networking for REST API calls

Asked on 08/02/2024

1 search

The recommended way to do networking for REST API calls in the context of Apple's WWDC sessions involves using Swift on the server. Specifically, you can use frameworks like Vapor or Hummingbird to set up your HTTP server and handle REST API calls.

Here are some key points from the sessions:

  1. Swift on Server: Swift is highlighted as an excellent choice for writing server applications due to its strong typing, optionals, memory safety, and first-class concurrency features. These properties make Swift services less prone to crashes and security vulnerabilities, and allow for scalable and responsive server applications. (Explore the Swift on Server ecosystem)

  2. Vapor Framework: Vapor is a popular framework for building server-side applications in Swift. It can be used to set up an HTTP server, define routes, and handle requests and responses. For example, you can create a Vapor application, register your service, and start the server to listen for incoming connections. (Explore the Swift on Server ecosystem)

  3. OpenAPI Generator: The Swift OpenAPI generator can be used to document your service in YAML and generate code for servers and clients. This can help in defining and implementing REST API endpoints. (Explore the Swift on Server ecosystem)

  4. Webhooks: For integrating with other services and tools, you can use webhooks. Xcode Cloud, for instance, allows you to set up webhooks to respond to build events and automate deployments. (Extend your Xcode Cloud workflows)

Relevant Sessions

These sessions provide a comprehensive overview of how to set up and manage REST API calls using Swift on the server.