Is markdown possible in a Table View footer text?

Is it possible to have some words on a grouped Table View footer in bold?

Other way to word the question: is it possible to easily apply markdown to a String in a Table View footer?


I have a table view with 16 sections and I have an array of Strings that is going to feed the `titleForFooterInSection` method with a simple `return footers[section]` call.


The result I would like to achieve is the one you can see on iPhone in Settings > Accessibility > Zoom. Some bold words, some lists...

Someone suggested me to make a custom UIView and then return it, but this would require 16 different views, with huge and slow method calls ... I would like to believe that there is an easier way.


Also, I would like to keep the app accessible, that is if the user increases the size of the text in accessiblity I cannot use `.systemFont(ofSize: 16, weight: .bold)` because it will not scale. On the other hand, if I use `preferredFont(for:)` it will not have neither a `range` to select nor a `bold` option... So confusing!

For what I have tried it seems I should use an NSMutableAttributedString to change the text to bold and then an NSAttributedString for the whole thing but ... `titleForFooterInSection` wants Strings and will probably loose all the formatting ... ****!


Can someone enlighten me on this?

Thank you so much!

Replies

Use viewForFooterInSection. Place an NSMutableAttributedString in the view that you return. (But this won't adjust for accessibility.)


From the discussion under that method:


The table view uses a fixed font style for section footer titles. If you want a different font style, return a custom view (for example, a

UILabel
object) in the delegate method
tableView:viewForFooterInSection:
instead.

Thanks! If this is not going to adjust font size for accessibility I think it may not be the way. Could you please look, on iOS, at Settings > Accessibility > Zoom The text underneath the section has some bold text and some list-like markdown features. If you then, always in Accessibility, increase the text size and go back to the Zoom page, you can see that everything is bigger but still bold and listed. Does anyone know how Apple managed to do this? Thanks!