-
-
Save sturdysturge/979b35db7cd6504c7f7f5b54659dfd6f to your computer and use it in GitHub Desktop.
This file contains 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
import SwiftUI | |
struct ScaledPaddingView: View { | |
var body: some View { | |
GeometryReader { geometry in | |
let frame = geometry.frame(in: .local) | |
Rectangle() | |
.foregroundColor(.red) | |
.padding(.horizontal, frame.maxX * 0.2) | |
.padding(.vertical, frame.maxY * 0.2) | |
.background(Color.green) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment