Skip to content

Server-driven SwiftUI - Maintain iOS apps without making app releases.

Notifications You must be signed in to change notification settings

andylindebros/ServerDrivenSwiftUI

Repository files navigation

ServerDrivenSwiftUI

Maintain ios apps without making app releases.

Deploy changes to the server and users will receive changes within minutes.

This package describes how you can use server-driven UI together with SwiftUI.

Instead of writing SwiftUI code directly into your app, you can write it on the server side. The app fetches the content and displays it according to the server side implementation. Just like a web browser!

Example of a server side implementation:

Models.VStack(spacing: 20) {
    Models.Image(systemName: "globe")
        .foregroundColor(.blue)
        .frame(width: 100)

    Models.Text("It works!")

    Models.Button(action: .reload) {
        Models.HStack(spacing: 4) {
            Models.Image(systemName: "arrow.uturn.left.circle")
                .frame(width: 20)
            Models.Text("Reload")
        }
    }
}

See example apps within this package

  • iOS App: ServerDrivenSwiftUIExampleProject
  • Vapor server - ServerExample

Run the example apps:

  1. open up your terminal
  2. navigate to the project and then to ServerExample
cd ServerDrivenSwiftUI/ServerExample
  1. Install vapor
brew install vapor

For more info how vapor works, see https://docs.vapor.codes

  1. enter vapor run to start the server
vapor run
  1. Open ServerDrivenSwiftUIExampleProject in xcode.
  2. Compile and run
  3. You should now be able to see the server rendered content in the app.