TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Background color question

Forums > SwiftUI

It must be background color day :)

I display the following view hierarchy when the user authencation fails. I'd like to change the entire background color of the view hierarchy. I can change the background color of the individual views but I can't change the background color of the entire hierarchy. Any ideas?

struct CannotConnect: View {
    var token: String
    var user: String
    var slug: String
    var failedAPICallMessage: String

    var body: some View {
        VStack {
            Image(systemName: "exclamationmark.square")
                .foregroundColor(Color.red)
                .font(.system(size: 27, weight: .regular, design: .rounded))
                .padding(1)
            Text("Connection error\n")
                .font(.system(size: 23, weight: .medium, design: .rounded))
                .foregroundColor(Color.red)
        }

        VStack {
            Text("The login credentials may be incorrect or EA may not be configured.\n")
        }
        .multilineTextAlignment(.center)

        VStack {
            Text("Token")
                .font(.system(size: 17, weight: .semibold, design: .rounded))
            Text("\(token)")
            Text("User")
                .font(.system(size: 17, weight: .semibold, design: .rounded))
            Text("\(user)")
            Text("Slug")
                .font(.system(size: 17, weight: .semibold, design: .rounded))
            Text("\(slug)")
            Text("\nMore information")
                .font(.system(size: 17, weight: .semibold, design: .rounded))
            Text("\(failedAPICallMessage)")
        }
        .font(.system(size: 15, weight: .light, design: .rounded))
        .presentationDetents([.height(700)])
        .padding(.horizontal)
    }
}

2      

Hacking with Swift is sponsored by Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.