Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions GlowBorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ struct GlowBorder: ViewModifier {
var lineWidth: Int

func body(content: Content) -> some View {
applyShadow(content: AnyView(content), lineWidth: lineWidth)
applyShadow(content: content, lineWidth: lineWidth)
}

func applyShadow(content: AnyView, lineWidth: Int) -> AnyView {
@ViewBuilder
func applyShadow<Content: View>(content: Content, lineWidth: Int) -> some View {
if lineWidth == 0 {
return content
content
} else {
return applyShadow(content: AnyView(content.shadow(color: color, radius: 1)), lineWidth: lineWidth - 1)
applyShadow(content: content.shadow(color: color, radius: 1), lineWidth: lineWidth - 1)
}
}
}
Expand Down