-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I think u cannot apply shadow directly on color...
but applying, on shape works.
public var body: some View {
HStack(spacing: 0) {
ForEach(tabs, id: \.self) { tab in
tabView(tab)
.background(Color.black.opacity(0.001))
.onTapGesture {
switchToTab(tab: tab)
}
}
}
.padding(.horizontal, insetPadding)
.background(
ZStack {
if let backgroundColor = backgroundColor {
backgroundColor
.cornerRadius(cornerRadius)
.shadow(
color: shadow.color, radius: shadow.radius, x: shadow.x, y: shadow.y
)
} else {
Color.clear
}
}
)
.padding(outerPadding)
}
and i think this extension is redundant? (i am not sure about old version of swift-UI, but in my setup, it just ignores negative values.
extension View {
@ViewBuilder func cornerRadiusIfNeeded(cornerRadius: CGFloat) -> some View {
if cornerRadius > 0 {
self
.cornerRadius(cornerRadius)
} else {
self
}
}
}
Metadata
Metadata
Assignees
Labels
No labels