Last active
December 29, 2023 03:35
-
-
Save benigumocom/29ed6f0e2cef78502aec8d6e40a72b7d to your computer and use it in GitHub Desktop.
【#SwiftUI】レイアウトの調整に View.background(Color.*) が便利だな 👉 https://android.benigumo.com/?p=30338&preview=true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ItemRow: View { | |
var body: some View { | |
VStack(alignment: .leading) { | |
Text("ベイスターズ優勝") | |
.font(.headline) | |
.background(.white) // * | |
Text("2023-12-28") | |
.font(.caption) | |
.foregroundStyle(.secondary) | |
.background(.red) // * | |
} | |
.background(.blue) // * | |
.padding() | |
.background(.yellow) // * | |
.frame(maxWidth: .infinity, alignment: .leading) | |
.background(.green) // * | |
.overlay( | |
Rectangle() | |
.stroke(.gray, lineWidth: 0.5) | |
) | |
} | |
} | |
PlaygroundPage.current.setLiveView( | |
ItemRow() | |
.frame(width: 300) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment