lukeredpath / swift-responsive-textfield

A SwiftUI wrapper around UITextField with binding-based state and responder control
Apache License 2.0
86 stars 13 forks source link

Add support for dynamic type #9

Closed lukeredpath closed 3 years ago

lukeredpath commented 3 years ago

Enables dynamic type support and automatic size adjustments by default, but configurable on initialisation.

This changes the behaviour of the .responsiveTextFieldFont() modifier - even though this uses the environment internally, we cannot keep setting the font in updateUIView otherwise it will override any content-size adjusted font that has been set internally by the text field.

With this change, the text field will only update based on changes to the font set in the environment using responsiveTextFieldFont if adjustsFontForContentSizeCategory is set to false - setting this to false means the caller is responsible for adjusting the font size dynamically.