11import Foundation
22
3+ /// A structure that defines the layout-related configurations for components in the framework.
34public struct Layout : Initializable , Updatable {
4- // MARK: Radius
5+ // MARK: - Radius
56
7+ /// A structure representing radius values for components.
68 public struct Radius {
9+ /// The small radius size.
710 public var small : CGFloat
11+ /// The medium radius size.
812 public var medium : CGFloat
13+ /// The large radius size.
914 public var large : CGFloat
1015
16+ /// Initializes a new `Radius` instance.
17+ ///
18+ /// - Parameters:
19+ /// - small: The small radius size.
20+ /// - medium: The medium radius size.
21+ /// - large: The large radius size.
1122 public init ( small: CGFloat , medium: CGFloat , large: CGFloat ) {
1223 self . small = small
1324 self . medium = medium
1425 self . large = large
1526 }
1627 }
1728
18- // MARK: BorderWidth
29+ // MARK: - BorderWidth
1930
31+ /// A structure representing border width values for components.
2032 public struct BorderWidth {
33+ /// The small border width.
2134 public var small : CGFloat
35+ /// The medium border width.
2236 public var medium : CGFloat
37+ /// The large border width.
2338 public var large : CGFloat
2439
40+ /// Initializes a new `BorderWidth` instance.
41+ ///
42+ /// - Parameters:
43+ /// - small: The small border width.
44+ /// - medium: The medium border width.
45+ /// - large: The large border width.
2546 public init ( small: CGFloat , medium: CGFloat , large: CGFloat ) {
2647 self . small = small
2748 self . medium = medium
2849 self . large = large
2950 }
3051 }
3152
32- // MARK: AnimationScale
53+ // MARK: - AnimationScale
3354
55+ /// A structure representing animation scale values for components.
56+ ///
57+ /// The values must be between `0.0` and `1.0`.
3458 public struct AnimationScale {
59+ /// The small animation scale.
3560 public var small : CGFloat
61+ /// The medium animation scale.
3662 public var medium : CGFloat
63+ /// The large animation scale.
3764 public var large : CGFloat
3865
66+ /// Initializes a new `AnimationScale` instance.
67+ ///
68+ /// - Parameters:
69+ /// - small: The small animation scale (0.0–1.0).
70+ /// - medium: The medium animation scale (0.0–1.0).
71+ /// - large: The large animation scale (0.0–1.0).
72+ /// - Warning: This initializer will crash if the values are outside the range of `0.0` to `1.0`.
3973 public init ( small: CGFloat , medium: CGFloat , large: CGFloat ) {
4074 guard small >= 0 && small <= 1.0 ,
4175 medium >= 0 && medium <= 1.0 ,
@@ -50,26 +84,48 @@ public struct Layout: Initializable, Updatable {
5084 }
5185 }
5286
53- // MARK: Fonts
87+ // MARK: - Typography
5488
89+ /// A structure representing a set of fonts for different component sizes.
5590 public struct FontSet {
91+ /// The small font.
5692 public var small : UniversalFont
93+ /// The medium font.
5794 public var medium : UniversalFont
95+ /// The large font.
5896 public var large : UniversalFont
5997
98+ /// Initializes a new `FontSet` instance.
99+ ///
100+ /// - Parameters:
101+ /// - small: The small font.
102+ /// - medium: The medium font.
103+ /// - large: The large font.
60104 public init ( small: UniversalFont , medium: UniversalFont , large: UniversalFont ) {
61105 self . small = small
62106 self . medium = medium
63107 self . large = large
64108 }
65109 }
66110
111+ /// A structure representing typography settings for various components.
67112 public struct Typography {
113+ /// The font set for headlines.
68114 public var headline : FontSet
115+ /// The font set for body text.
69116 public var body : FontSet
117+ /// The font set for buttons.
70118 public var button : FontSet
119+ /// The font set for captions.
71120 public var caption : FontSet
72121
122+ /// Initializes a new `Typography` instance.
123+ ///
124+ /// - Parameters:
125+ /// - headline: The font set for headlines.
126+ /// - body: The font set for body text.
127+ /// - button: The font set for buttons.
128+ /// - caption: The font set for captions.
73129 public init ( headline: FontSet , body: FontSet , button: FontSet , caption: FontSet ) {
74130 self . headline = headline
75131 self . body = body
@@ -78,24 +134,33 @@ public struct Layout: Initializable, Updatable {
78134 }
79135 }
80136
81- // MARK: Properties
137+ // MARK: - Properties
82138
139+ /// The opacity level for disabled components.
83140 public var disabledOpacity : CGFloat = 0.5
141+
142+ /// The radius configuration for components.
84143 public var componentRadius : Radius = . init(
85144 small: 10.0 ,
86145 medium: 12.0 ,
87146 large: 16.0
88147 )
148+
149+ /// The border width configuration for components.
89150 public var borderWidth : BorderWidth = . init(
90151 small: 1.0 ,
91152 medium: 2.0 ,
92153 large: 3.0
93154 )
155+
156+ /// The animation scale configuration for components.
94157 public var animationScale : AnimationScale = . init(
95158 small: 0.99 ,
96159 medium: 0.98 ,
97160 large: 0.95
98161 )
162+
163+ /// The typography configuration for components.
99164 public var typography : Typography = . init(
100165 headline: . init(
101166 small: . system( size: 14 , weight: . semibold) ,
@@ -119,5 +184,8 @@ public struct Layout: Initializable, Updatable {
119184 )
120185 )
121186
187+ // MARK: - Initialization
188+
189+ /// Initializes a new `Layout` instance with default values.
122190 public init ( ) { }
123191}
0 commit comments