Christian Tietze

  • Blog Posts
  • Writing
  • Apps
  • Work With Me
  • Contact

Overview of Attribute Fixing in NSTextStorage

Sep 21st, 2022

NSTextStorage provides attribute fixing of user-entered text, via NSMutableAttributedString.fixAttributes(in:). Attribute fixing… NSMutableAttributedString.fixAttributes(in:) always work on full paragraph ranges. It extends the passed-in range as needed “to cover the last paragraph partially contained”.

Continue reading …

  • ∞ Permalink
  • • Comments
  • • Tags:
    • nstextstorage
    • nsattributedstring
    • syntax-highlighting

More Swifty NSAttributedString Attribute Query Methods

Mar 9th, 2022

NSAttributedString API takes an NSRange by-reference. That’s cumbersome to use, though, because you need to initialize a non-nil range, and there you should initialize it with NSNotFound to indicate an illegal state. Afterwards, you need to check if the range changed to a legal value.

Continue reading …

  • ∞ Permalink
  • • Comments
  • • Tags:
    • nsattributedstring
    • nstextstorage

Contact • Newsletter • Blog Feed • /feeds • /now • /uses • @ctietze@mastodon.social • Privacy & Legal Information

Except where otherwise noted, content on this site is licensed CC BY-SA 4.0.

As an Amazon Associate I earn from qualifying purchases. This e.g. applies to links to Amazon.com.