Last active
July 2, 2025 02:34
-
-
Save brownsoo/7765d7bd529a9e3b78def037cd365d8f to your computer and use it in GitHub Desktop.
SwiftUI View, 부모의 가로 크기에 맞게 잘라보이게 만드는 VIewModifier
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
import SwiftUI | |
struct HorizontalClipModifier: ViewModifier { | |
func body(content: Content) -> some View { | |
ZStack(alignment: .leading) { | |
content.hidden().layoutPriority(1) | |
content.fixedSize(horizontal: true, vertical: false) | |
} | |
.clipped() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment