Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Hello guys, today we learn about “Text Formatting In Swift”.
In this blog, we are going to learn about how to format the text like:- bold, italic, underline, and how can we change the text color. sometimes we need to bold, italic, or underline some word in a paragraph. so in this blog, we learn this thing one by one.
For doing text formatting we need NSAttributedString
A string with associated attributes (such as visual style, hyperlinks, or accessibility data) for a portion of its text.
NSAttributedString uses with UILabel and UITextView which is accepted attribute string directly. when we write a simple string we don’t need it but sometimes we want some string characters like – bold, italic, underline and sometimes we want to change the color of some character that time we called a class knows as NSAtrributedString.
1. Bold:- for changing the text as bold we need .boldSystemFont
2. Italic:- for changing the text as italic we need .italicSyatemFont
3. Underline:- for changing the text as underline we need NSUnderlineStyle
4. color:- for changing the text color we need .foregroundColor: color name
2. code for text formatting
In this blog, we discussed Text Formatting In Swift
I hope this blog will help you to get about text formatting
Thanks for reading !!
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Stathis Plakidas
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.