0

I am working on objective-C to swift conversion. For conversion, I am using String for NSString and Array for NSArray. Similarly, when I try to convert NSAttributedString , I could not find a structure type. Is there any structure type that can be used instead of NSAttributedString class or I must and should use NSAttributedString class itself for the conversion

3
  • 3
    we can use NSAttributedString in swift Commented Sep 26, 2019 at 7:34
  • 1
    Swift String is just for plain text but for color, images, urls etc. you will use NSAttributedString. Commented Sep 26, 2019 at 7:39
  • 1
    NSAttributedString is part of Cocoa, it's in the framework, it's not related to the language. Commented Sep 26, 2019 at 8:04

1 Answer 1

1

The simple answer is no, you can and should use NSAttributedString even if you're writing Swift code.

E.g. As you can see here the property attributedText of UILabel is of type NSAttributedString.

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.