UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Font rendered differently than UIKit

Forums > SwiftUI

Hi folks,

Did anyone faced an issue with the fonts? I have currently migrated an entire view from UIKit (Storyboard) to SwiftUI, same font same size basically just a refactor to SwiftUI but the screen looks different, looks like the text srinks a bit,

Does SwiftUI renders differently over UIHostingController, why the size of the font is not the same in UIKit and SwiftUI did anyone face something similar?

1      

Same problem here. I found that the font is roughly 8% bigger in UIKit than in SwiftUI. Did you find a solution/reason for this?

1      

The problem (At least I consider it a problem) with using UIKit is that there are so many different places where you can choose to set properties for the same object in order to get the same desired effect.

If you have a UILabel, for example, you might have selected one font size for it in the Storyboard, but then set another size for it in your viewDidLoad() function, or even in some other function. But, even if you set the font size the same in both places, maybe you set its frame differently, and maybe you changed the settings for how it fills its frame in the storyboard. Or, maybe you set the stretching or some other setting differently. It's hard to track down all of the settings you set or that one particular object without looking through every single setting. Whereas, with SwiftUI, you basically set everything for one object using modifiers that are attached directly to the object, making them much easier to find.

1      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.