Get Updates By E-mail 

Article Written By:
Johann Dowa

BonMot – Open Source Library Providing Easy Advanced Text Formatting For Attributed Strings

  •  
  •  
  •  
  •  
  •  

BonMot is an open source library from Raizlabs for working with attributed strings making it easy to utilize advanced typography with your attributed strings.

BonMot provides a clean, chainable syntax for working with advanced text features including, fonts, coloring, alignment, text formatting, inline images, and more.

This snippet from the readme shows how one could format text using BonMot:

let quote = "I used to love correcting people's grammar until" +
            "I realized what I loved more was having friends.\n" +
            "-Mara Wilson"

// line-wrapped for readability
let attributedString = BONChain()
    .lineHeightMultiple(1.2)
    .fontNameAndSize("AmericanTypewriter", 17.0)
    .string(quote)
    .attributedString   // You can also query .attributes
                        // and get back a dictionary of attributes

You can find BonMot on Github here.

A great library for easy text formatting.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments