Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

El tema de los colores. #8

Closed
oliverjtowers opened this issue May 5, 2022 · 2 comments
Closed

El tema de los colores. #8

oliverjtowers opened this issue May 5, 2022 · 2 comments

Comments

@oliverjtowers
Copy link

Lo que comenté en el Episodio 020, entiendo que funcione así (porque patata), pero no entiendo por qué uno tiene "dos tonos" y el otro no...

ContentView.swift

import SwiftUI

let colors1: [UIColor] = [.blue, .green, .orange, .red, .purple, .brown, .gray] // UIKit
let colors2: [UIColor] = [.systemBlue, .systemGreen, .systemOrange, .systemRed, .systemPurple, .systemBrown, .systemGray] // UIKit System
let colors3: [Color] = [.blue, .green, .orange, .red, .purple, .brown, .gray] // SwiftUI

struct ContentView: View {
    var body: some View {
        HStack(spacing:0) {
            VStack(spacing: 0) {
                ForEach(colors1, id: \.self) { color in
                    Text("UIKit")
                        .foregroundColor(.white)
                        .frame (maxWidth: .infinity, minHeight: 64)
                        .background(Color(color))
                }
            }
            VStack(spacing: 0) {
                ForEach(colors2, id: \.self) { color in
                    Text("UIKit System")
                        .foregroundColor(.white)
                        .frame (maxWidth: .infinity, minHeight: 64)
                        .background(Color(color))
                }
            }
            VStack(spacing: 0) {
                ForEach(colors3, id: \.self) { color in
                    Text("SwiftUI")
                        .foregroundColor(.white)
                        .frame (maxWidth: .infinity, minHeight: 64)
                        .background(color)
                }
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
@dfreniche
Copy link
Owner

Muy buena pregunta, que me ha llevado a un pequeño "rabbit hole". Si no te parece mal, lo comento en el stream, porque podemos ver bastantes cosas interesantes. Pero long story short: son colores distintos. Por eso se "ven"distintos.

@dfreniche
Copy link
Owner

Espero que cubierto en el Ep 021!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants