Skip to content

Commit 4ce526b

Browse files
update readme
1 parent 3394c1d commit 4ce526b

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

README.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ inputField.resignFirstResponder()
8181

8282
**Config**
8383

84-
The library comes with predefined sizes and colors, but you can change these values to customize the appearance of your app. To do this, alter the config:
84+
The library comes with predefined fonts, sizes and colors, but you can change these values to customize the appearance of your app. To do this, alter the config:
8585

8686
```swift
8787
ComponentsKitConfig.shared.update {
8888
// Update colors
8989
$0.colors.primary = ...
9090

9191
// Update layout
92-
$0.layout.componentFont.medium = ...
92+
$0.layout.componentRadius.medium = ...
9393
}
9494
```
9595

@@ -120,47 +120,43 @@ All colors from the config can be used within the app. For example:
120120

121121
```swift
122122
// in UIKit
123-
view.backgroundColor = Palette.Base.background.uiColor
123+
view.backgroundColor = UniversalColor.background.uiColor
124124

125125
// in SwiftUI
126126
@Environment(\.colorScheme) var colorScheme
127-
Palette.Base.background.color(for: colorScheme)
127+
UniversalColor.background.color(for: colorScheme)
128128
```
129129

130-
If you want to use additional colors that are not included in the config, you can extend `Palette`:
130+
If you want to use additional colors that are not included in the config, you can extend `UniversalColor`:
131131

132132
```swift
133-
extension Palette {
134-
enum MyColors {
135-
static var special: UniversalColor {
136-
if selectedTheme == .halloween {
137-
return ...
138-
} else {
139-
return ...
140-
}
133+
extension UniversalColor {
134+
static var special: UniversalColor {
135+
if selectedTheme == .halloween {
136+
return ...
137+
} else {
138+
return ...
141139
}
142140
}
143141
}
144142

145143
// Then in your class
146144
let view = UIView()
147-
view.backgroundColor = Palette.MyColors.special.uiColor
145+
view.backgroundColor = UniversalColor.special.uiColor
148146
```
149147

150148
**Extend Fonts**
151149

152-
The config defines only three font sizes, but if you want to use semantic font values in your app, you can extend the `UniversalFont` struct:
150+
If you want to use additional fonts that are not included in the config, you can extend `UniversalFont`:
153151

154152
```swift
155153
extension UniversalFont {
156-
enum Text {
157-
static let body: UniversalFont = .system(size: 16, weight: .regular)
158-
}
154+
static let title: UniversalFont = .system(size: 16, weight: .regular)
159155
}
160156

161157
// Then in your view
162158
Text("Hello, World")
163-
.font(UniversalFont.Text.body.font)
159+
.font(UniversalFont.title.font)
164160
```
165161

166162
You can also extend `UniversalFont` for easier access to custom fonts:

0 commit comments

Comments
 (0)