Hi, I'm trying different ways to use Compose Multi...
# compose-ios
c
Hi, I'm trying different ways to use Compose Multiplatform views as components inside SwiftUI views. I'm not trying to replace a whole screen, but only some components, like buttons or list items. My eventual goal is to have a UI library written in Compose that I can use in SwiftUI. One problem that I ran into was Text Rendering. Most components I'm trying to build contain some form of text. However, text rendered in Compose looks different that native SwiftUI text, even when using the same size and color. Could someone explain to me why that is and how to get around that? I'd also appreciate input as to whether my goal is a supported use case, to begin with.
k
could you share a small sample project with the problem?
I don't see any significant difference
c
Thank you so much for your reply and the example. I'm going to experiment a little bit more and then come back to you 🙂
j
Without seeing you’re code, could it be an issue of you not using the same Font family?
c
I experimented a bit and it looks like this is a non-issue when using custom fonts. The rendering is almost identical. When turning up the font size in accessibility settings there are some minor differences (see attached). The default font of compose on iOS is also not quite identical. How does that work under the hood? Does Compose use a custom font that resembles the current iOS system font or does it have direct access to it? When I initially asked this question, I had my Text Composeable wrapped in a Material Theme -.-
e
Font size won’t scale using the same rules as iOS, non-linear scaling like in iOS will break the design of material widgets with multiple font sizes used.