Skip to content

Instantly share code, notes, and snippets.

@brownsoo
Last active July 2, 2025 02:34
Show Gist options
  • Save brownsoo/7765d7bd529a9e3b78def037cd365d8f to your computer and use it in GitHub Desktop.
Save brownsoo/7765d7bd529a9e3b78def037cd365d8f to your computer and use it in GitHub Desktop.
SwiftUI View, 부모의 가로 크기에 맞게 잘라보이게 만드는 VIewModifier
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