TransWikia.com

How Can I create Blue View in SwiftUI?

Stack Overflow Asked by Davis Zhang on August 19, 2020

I’d like to create a View with a pure background color of blue in SwiftUI.

What I’m going to do, in UIKit I’m going to create a UIView. But SwiftUI doesn’t have UIView in it

just look like this。 NO have text, NO have Image。
enter image description here

One Answer

Here is seems simplest (if you need to have it explicitly named)

enter image description here

struct BlueView: View {
    var body: some View {
        Color.blue.edgesIgnoringSafeArea(.all)
    }
}

Or just use Color.blue.edgesIgnoringSafeArea(.all) in-place (like background, etc.)

Correct answer by Asperi on August 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP