0

We're developing an app in Swift with al lot of bullet point lists. I know how to create the bullets (\U2022, since I'm using localized strings). I also know how to pick a particulair string and create an attributed string which takes care of paragraphstyle for the indentation, etc. My issue though is, we are using a lot of strings with a lot of bullet lists.

My question; is there a more generic way to pick a random string, detect if it has any bullet points (\U2022) and, if so, pick the bullet points and align them left, make an indentation, etc? I can imagine there might be a way to use an extension on String which transforms a strings bullet list if it has any bullet points.

Thanks in advance! Martin

Martinos
  • 1
  • 2
  • did you consider to use a NSAttributedString with NSHTMLTextDocumentType ? moreover you might embed a CSS class, then customize easily the indentation, and so on... – mugx Dec 18 '17 at 10:53
  • A tableview or collectionview might be a better solution than just strings. – Eric Aya Dec 18 '17 at 10:54
  • 1
    @AndreaMugnaini - Thanks for your answer, we're implementing it right at the moment and it seems like a good solution. Moreover, I'm familiar with CSS, but have never used it in one of my apps. I'm going to check it out, thanks again! – Martinos Dec 20 '17 at 16:13
  • @Martinos you are welcome :) – mugx Dec 20 '17 at 17:11
  • More generic way than what? – Caleb Feb 06 '18 at 15:53

0 Answers0