Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex009 committed Aug 22, 2024
2 parents d1705db + 71095fc commit b1e2a75
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ In Xcode add `Build Phase` (at end of list) with script:
To disable warnings about static framework in gradle.properties:

```xml
moko.resources.disableStaticFrameworkWarning=false
moko.resources.disableStaticFrameworkWarning=true
```

### iOS executable
Expand Down Expand Up @@ -728,6 +728,24 @@ val font: Font = MR.fonts.Raleway.italic.asFont(
style = FontStyle.Normal // optional
)
```
#### SwiftUI

For SwiftUI, create this `Font` extension:

```swift
extension Font {
init(resource: KeyPath<MR.fonts, FontResource>, withSize: Double = 14.0) {
self.init(MR.fonts()[keyPath: resource].uiFont(withSize: withSize))
}
}
```

Then, you can refer to `FontResource`s directly by their key path, which provides compiler errors for typos or missing resources:

```swift
Text("Text displayed resource font")
.font(Font(resource: \.raleway_regular, withSize: 14.0))
```

### Example 9 - pass colors

Expand Down

0 comments on commit b1e2a75

Please sign in to comment.