1

Starting with iOS 15 SwiftUI has a modifier to limit the Dynamic Type size within a view to a given range (when user changes the font size via accessibility):

https://developer.apple.com/documentation/swiftui/view/dynamictypesize(_:)-26aj0

Is there a solution for iOS 13 & 14?

2
  • Were you able to find and answer for this? Commented May 23, 2022 at 18:05
  • nah, eventually I handled it manually by checking current size Commented Jun 2, 2022 at 1:43

1 Answer 1

7

It may be late, but I’ve faced the same problem before and created an extension. You can use it like a dynamicTypeSize modifier.

https://gist.github.com/MMP0/2c1b581ad071c4279806ed5ad995a18a

// iOS 13 - 14
Text("sizeCategory")
    .sizeCategory(.large ... .extraExtraExtraLarge)

// iOS 15+
Text("dynamicTypeSize")
    .dynamicTypeSize(.large ... .xxxLarge)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.