forked from TokamakUI/Tokamak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
public struct _ShadowLayout: ViewModifier { | ||
public var color: Color | ||
public var radius: CGFloat | ||
public var x: CGFloat | ||
public var y: CGFloat | ||
|
||
public func body(content: Content) -> some View { | ||
content | ||
} | ||
} | ||
|
||
public extension View { | ||
func shadow( | ||
color: Color = Color(.sRGBLinear, white: 0, opacity: 0.33), | ||
radius: CGFloat, | ||
x: CGFloat = 0, | ||
y: CGFloat = 0 | ||
) -> some View { | ||
modifier(_ShadowLayout(color: color, radius: radius, x: x, y: y)) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import TokamakShim | ||
|
||
struct ShadowDemo: View { | ||
var body: some View { | ||
Color.red.frame(width: 60, height: 60, alignment: .center) | ||
.shadow(color: .black, radius: 5, x: 10, y: 10) | ||
} | ||
} |
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
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