Skip to content

Write SwiftUI / Tokamak apps on Fastly Compute@Edge

Notifications You must be signed in to change notification settings

swift-cloud/ComputeUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComputeUI

Build server side rendered webpages in SwiftUI

import ComputeUI

struct IndexPage: View {

    @Environment(\.request) var req

    var body: some View {
        VStack {
            Text("Hello, Swift")
                .font(.title)

            Text("This is a server rendered SwiftUI website")
                .font(.subheadline)

            Text("Your ip address \(req.clientIpAddress().stringValue)")
        }
    }
}

try await Router()
    .get("/", IndexPage())
    .listen()