@@ -19,24 +19,22 @@ import SwiftUI
1919/// use a primary foreground color, a clear background color
2020/// and a material background.
2121public struct TagCapsuleStyle {
22-
22+
2323 /// Create a new tag capsule style.
2424 ///
2525 /// - Parameters:
2626 /// - foregroundColor: The foreground color, by default `.primary`.
2727 /// - backgroundColor: The background color, by default `.clear`.
2828 /// - backgroundMaterial: The background material, by default `.ultraThin`.
29- /// - borderColor: The border color, by default `.clear`.
30- /// - borderWidth: The border width, by default `1`.
29+ /// - border: The border style, by default ``Border/standard``.
3130 /// - shadow: The shadow style, by default ``Shadow/standard``.
3231 /// - padding: The intrinsic padding to apply, by default a small padding.
3332 public init (
3433 foregroundColor: Color = . primary,
3534 backgroundColor: Color = . clear,
3635 backgroundMaterial: Material ? = . ultraThin,
37- borderColor: Color = . clear,
38- borderWidth: Double = 1 ,
39- shadowStyle: Shadow = . standard,
36+ border: Border = . standard,
37+ shadow: Shadow = . standard,
4038 padding: EdgeInsets ? = nil
4139 ) {
4240 var defaultPadding : EdgeInsets
@@ -49,10 +47,32 @@ public struct TagCapsuleStyle {
4947 self . foregroundColor = foregroundColor
5048 self . backgroundColor = backgroundColor
5149 self . backgroundMaterial = backgroundMaterial
52- self . borderColor = borderColor
53- self . borderWidth = borderWidth
50+ self . border = border
51+ self . shadow = shadow
5452 self . padding = padding ?? defaultPadding
55- self . shadow = shadowStyle
53+ }
54+
55+ @available ( * , deprecated, message: " Use the new borderStyle initializer instead. " )
56+ public init (
57+ foregroundColor: Color = . primary,
58+ backgroundColor: Color = . clear,
59+ backgroundMaterial: Material ? = . ultraThin,
60+ borderColor: Color = . clear,
61+ borderWidth: Double = 1 ,
62+ shadow: Shadow = . standard,
63+ padding: EdgeInsets ? = nil
64+ ) {
65+ self . init (
66+ foregroundColor: foregroundColor,
67+ backgroundColor: backgroundColor,
68+ backgroundMaterial: backgroundMaterial,
69+ border: . init(
70+ color: borderColor,
71+ width: borderWidth
72+ ) ,
73+ shadow: shadow,
74+ padding: padding
75+ )
5676 }
5777
5878 /// The foreground color.
@@ -64,19 +84,41 @@ public struct TagCapsuleStyle {
6484 /// The background material.
6585 public var backgroundMaterial : Material ?
6686
67- /// The border color.
68- public var borderColor : Color
69-
70- /// The border width.
71- public var borderWidth : Double
87+ /// The border style.
88+ public var border : Border
7289
73- // The shadow style.
90+ /// The shadow style.
7491 public var shadow : Shadow
7592
7693 /// The padding to apply to the text.
7794 public var padding : EdgeInsets
7895}
7996
97+ public extension TagCapsuleStyle {
98+
99+ struct Border {
100+
101+ /// Create a new tag capsule border style.
102+ ///
103+ /// - Parameters:
104+ /// - color: The border color, by default `.clear`.
105+ /// - width: The border width, by default `1`.
106+ public init (
107+ color: Color = . clear,
108+ width: Double = 1
109+ ) {
110+ self . color = color
111+ self . width = width
112+ }
113+
114+ /// The border color.
115+ public var color : Color
116+
117+ /// The border width.
118+ public var width : Double
119+ }
120+ }
121+
80122public extension TagCapsuleStyle {
81123
82124 struct Shadow {
@@ -125,14 +167,15 @@ public extension TagCapsuleStyle {
125167 static var standardSelected : Self {
126168 . init(
127169 backgroundMaterial: . regular,
128- shadowStyle: . standardSelected
170+ border: . standardSelected,
171+ shadow: . standardSelected
129172 )
130173 }
131174}
132175
133176public extension TagCapsuleStyle . Shadow {
134177
135- /// The standard style.
178+ /// The standard shadow style.
136179 static var standard : Self {
137180 . init( )
138181 }
@@ -146,6 +189,19 @@ public extension TagCapsuleStyle.Shadow {
146189 }
147190}
148191
192+ public extension TagCapsuleStyle . Border {
193+
194+ /// The standard border style.
195+ static var standard : Self {
196+ . init( )
197+ }
198+
199+ /// The standard, selected border style.
200+ static var standardSelected : Self {
201+ . init( )
202+ }
203+ }
204+
149205public extension TagCapsuleStyle {
150206
151207 @available ( * , deprecated, renamed: " standard " )
0 commit comments