Methods to allow using HTML code with CoreText

Related tags

Text DTCoreText


This project aims to duplicate the methods present on Mac OSX which allow creation of NSAttributedString from HTML code on iOS.

The project covers two broad areas:

  1. Layouting - Interfacing with CoreText, generating attributed strings from HTML code
  2. User Interface - UI-related classes render these objects, specifically DTAttributedTextView, DTAttributedLabel and DTAttributedTextCell.

This is useful for drawing simple rich text like any HTML document without having to use a web view. For text selection and highlighting (as you might need for an Editor or Reader) there is the commercial DTRichTextEditor component which can be purchased in the Cocoanetics Parts Store.


Documentation can be browsed online or installed in your Xcode Organizer via the Atom Feed URL.

A Q&A answers some frequently asked questions.

Changelog: GitHub Releases

There is also a Programming Guide with a set of solutions to common problems.

Follow @cocoanetics on Twitter or subscribe to the Cocoanetics Blog for news and updates.


It is open source and covered by a standard 2-clause BSD license. That means you have to mention Cocoanetics as the original author of this code and reproduce the LICENSE text inside your app.

You can purchase a Non-Attribution-License for 75 Euros for not having to include the LICENSE text.

We also accept sponsorship for specific enhancements which you might need. Please contact us via email for inquiries.

  • Compatibility with CocoaPods 0.36 and frameworks

    Compatibility with CocoaPods 0.36 and frameworks

    CocoaPods 0.36 is on release candidate 1. It adds support for Swift and embedded frameworks/modules. Unfortunately, DTCoreText is not compatible. Several of it's header files include headers from DTFoundation using the #import "DTClass.h" format instead of #import <DTFoundation/DTClass.h>.

    Simply changing these import statements fixed modules in my project. Unfortunately, when I tried to do the same in the demo project, it didn't work because there DTFoundation is not included as a separate framework. And I'm guessing it would likely break other projects that include DTCoreText as well.

    opened by davbeck 34
  • Implement Mac Rendering

    Implement Mac Rendering

    I am creating an HTML String from an NSAttributedString using the Category' s html method. Since _iOS6TagsPossible is false on OSX 10.8, colors are ignored by the renderer. I've quickly patched DHTMLWriter just for testing:


        _iOS6TagsPossible = YES;


    and it works. (NS)Colors in AttributedStrings seem to be stored under the NSForegroundColorAttributeName Key, not under kCTForegroundColorAttributeName.

    Maybe this has nothing to with Mountain Lion at all but with OSX in general?

    opened by artifacts 34
  • DTAttributedTextContentView sizeToFit and top margin

    DTAttributedTextContentView sizeToFit and top margin

    I am populating a DTAttributedTextContentView as follows

    NSString *s = @"Vゾーンの自己表現を豊かにする、シルクタイが到着。ランダムにあしらったドット柄に色の濃淡でさらに表情を加え、定番のドット柄ネクタイをモダンな1本へと昇華しています。落ち着いた色使いで、ビジネススタイルにもマッチ。軽快なジャケット&パンツスタイルとも好相性な1本です。";
    NSAttributedString *as = [[[DTHTMLAttributedStringBuilder alloc]
        initWithHTML:[s dataUsingEncoding:NSUTF8StringEncoding]
            DTDefaultTextColor: [UIColor grayColor],
            DTDefaultFontSize: @(20),
            DTDefaultLineHeightMultiplier: @(2.0),
            DTDefaultFontFamily: @"Helvetica"
        documentAttributes:NULL] generatedAttributedString];
    [self.textView setAttributedString:as];

    and then call `[self.textView sizeToFit]. Unfortunately there is way too much space at the top.

    screen shot 2013-05-16 at 14 00 29

    What am I doing wrong there?

    Known Issue 
    opened by tcurdt 29
  • Using custom objects crashes iOS7

    Using custom objects crashes iOS7

    [DTAttributedTextContentView superlayer]: unrecognized selector sent to instance

    I tried tracking it down, but couldn't find the culprit.

    It happens in the demo app, Custom Objects example.

    Need more Info 
    opened by rdougan 28
  • Support Basic Text Tables

    Support Basic Text Tables

    It should be doable to support simple text tables similar as text boxes are now supported.

    Contact me if you need that and want to sponsor implementation of this feature.

    Feature Sponsor Needed 
    opened by odrobnik 28
  • Italic style has no effect if the text is chinese

    Italic style has no effect if the text is chinese

    In issues 104, the chinese bold style problem has been resolved, but the Italic style of chinese has the same problem, the chinese character is same when italic style is set or not. The example html is: <--p style="font-size:20px;">东方盖饭<--/p> <--p style="font-size:20px;font-style:italic;">东方盖饭<--/p> (please remove '--' by yourself) By the way, the issues 104 is not only exists in ios 5, but ios 4.

    opened by geniuslinchao 27
  • Last list element weird padding

    Last list element weird padding


    Im trying to sort out a problem with lists. The last element in the list always gets a padding between the dot and the text. (See picture below)

    I have found that it startet to behave like this after commit 66a90748630291841da44f929f23e1ab577499f3

    I will continue to look into it. But maybe you guys know what the issue is without even looking a it :)

    Thanks in advance.

    Code used:

        self.textView = [[DTAttributedTextView alloc] initWithFrame:self.view.frame];
        NSDictionary *builderOptions = @{
                                         DTDefaultFontFamily: @"Helvetica"
        NSString *html = @"<ul><li>test</li><li>test</li></ul>";
        NSData *htmlData = [html dataUsingEncoding:NSUTF8StringEncoding];
        DTHTMLAttributedStringBuilder *stringBuilder = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:htmlData options:builderOptions documentAttributes:nil];
        self.textView.attributedString = [stringBuilder generatedAttributedString];

    ios simulator screen shot 2 juli 2013 08 28 02

    opened by Torsph 25
  • Crash in (NSRange)_effectiveRangeOfOutermostTextBlocksInRange:(NSRange)range

    Crash in (NSRange)_effectiveRangeOfOutermostTextBlocksInRange:(NSRange)range

    Versions tested: pod 'DTCoreText', '~>1.6.6' and pod 'DTCoreText', :head

    We are rendering text in columns inside a collection view. When we build the cell with the column layout (sometimes, with more frequency on simulator), we receive a crash in DTCoreTextLayoutFrame in the method:



    captura de pantalla 2013-09-18 a la s 15 29 36

    captura de pantalla 2013-09-18 a la s 15 29 59

    In Xcode5, the console shows the following stacktrace:

    2013-09-19 10:53:20.970 App[3116:2a8b] +[__NSCFString objectForKey:]: unrecognized selector sent to class 0x3bd933c
    2013-09-19 10:53:20.973 App[3116:2a8b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[__NSCFString objectForKey:]: unrecognized selector sent to class 0x3bd933c'
    *** First throw call stack:
        0   CoreFoundation                      0x03a945e4 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x02f508b6 objc_exception_throw + 44
        2   CoreFoundation                      0x03b317a3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 275
        3   CoreFoundation                      0x03a8490b ___forwarding___ + 1019
        4   CoreFoundation                      0x03a844ee _CF_forwarding_prep_0 + 14
        5   Foundation                          0x00cb5119 -[NSConcreteMutableAttributedString attribute:atIndex:effectiveRange:] + 82
        6   App                                 0x000ffc34 -[DTCoreTextLayoutFrame _effectiveRangeOfOutermostTextBlocksInRange:] + 276
        7   App                                 0x001013b7 -[DTCoreTextLayoutFrame _enumerateTextBlocksInRange:usingBlock:] + 103
        8   App                                 0x00101864 -[DTCoreTextLayoutFrame _drawTextBlocksInContext:inRange:] + 228
        9   App                                 0x00103043 -[DTCoreTextLayoutFrame drawInContext:options:] + 2019
        10  App                                 0x000e5dc1 -[DTAttributedTextContentView drawLayer:inContext:] + 785
        11  QuartzCore                          0x01834209 -[CALayer drawInContext:] + 123
        12  QuartzCore                          0x0184ca98 _ZL18tiled_layer_renderP16_CAImageProviderjjjjPv + 1660
        13  QuartzCore                          0x0172d1c3 _ZL21CAImageProviderThreadPjb + 908
        14  QuartzCore                          0x0172ce32 _ZL31CAImageProviderBackgroundThreadPv + 19
        15  libdispatch.dylib                   0x034ad4b0 _dispatch_client_callout + 14
        16  libdispatch.dylib                   0x0349bef1 _dispatch_root_queue_drain + 287
        17  libdispatch.dylib                   0x0349c13d _dispatch_worker_thread2 + 39
        18  libsystem_c.dylib                   0x037f5e72 _pthread_wqthread + 441
        19  libsystem_c.dylib                   0x037dddaa start_wqthread + 30
    libc++abi.dylib: terminating with uncaught exception of type NSException
    opened by brovador 24
  • DTCoreText.h file not found

    DTCoreText.h file not found

    For some reason I can't compile my app anymore and I can't for the live of me figure out why - it used to work once. How is it DTCoreText can't find its own header?

    projectroot/Externals/DTCoreText/Core/Source/DTCoreTextFontDescriptor.h:9:9: 'DTCoreText/DTCoreText.h' file not found

    I've set up a fresh submodule:

    [submodule "Externals/DTCoreText"]
            path = Externals/DTCoreText
            url =

    added it as a subproject

    screen shot 2015-09-15 at 21 18 41

    set header paths

    screen shot 2015-09-15 at 21 18 59

    (I've tried many variations here, though I don't think this is the source of the error?)

    added library to link

    screen shot 2015-09-15 at 21 18 26

    any suggestions?

    opened by cboe 23
  • Unable to use DTCoreText due to compilation error

    Unable to use DTCoreText due to compilation error

    DTCoreText is an excellent library and I am very excited to use it in my project because its really going to help me. However, I am having trouble getting it working in my project. I have followed the exact instructions from the but the following code below NSAttributedString *description = [NSAttributedString initWithHTMLData:[product.productdescription dataUsingEncoding:NSUTF8StringEncoding]documentAttributes: nil];

    gives this error during build

    No known class method for selector 'initWithHTMLData:documentAttributes:'

    I am using Xcode 4.6 and targetting iOS 6.1

    Please Help.

    opened by aniruddhch 23
  • Under iOS13 (Beta 7) TimesNewRomanPSMT will be used instead of SFUI

    Under iOS13 (Beta 7) TimesNewRomanPSMT will be used instead of SFUI

    If you set DTDefaultFontFamily and DTDefaultFontName to iOS13 system font (family: .AppleSystemUIFont name: .SFUI-Regular) e.g. in initWithHTMLData:

    NSAttributedString *attributedString = [[NSAttributedString alloc] initWithHTMLData:data options:@{ DTUseiOS6Attributes: @YES, DTDefaultFontFamily: [UIFont systemFontOfSize:[UIFont systemFontSize]].familyName, DTDefaultFontName : [UIFont systemFontOfSize:[UIFont systemFontSize]].fontName, DTDefaultFontSize : @([UIFont systemFontSize])} documentAttributes:nil];

    you will get the following message:

    CoreText performance note: Client called CTFontCreateWithName() using name ".SFUI-Regular" and got font with PostScript name "TimesNewRomanPSMT". For best performance, only use PostScript names when calling this API.

    Sponsor Needed 
    opened by jingx23 22
  • Set spacing between lines.

    Set spacing between lines.

    How can I achieve apple spacing between lines? Exmaple

    Code I am using:

    public func returnAttributedStringForHTMLString(
        fontFamily: String,
        fontName: String,
        fontSize: CGFloat,
        textColor: UIColor,
        textAlignment: CTTextAlignment
      ) -> NSMutableAttributedString {
        let encodedData = String.Encoding.utf8)!
        let options = [
          DTDefaultFontFamily: fontFamily,
          DTDefaultFontName: fontName,
          DTDefaultFontSize: fontSize,
          DTDefaultTextColor: textColor,
          DTDefaultTextAlignment: NSNumber(value: textAlignment.rawValue),
        ] as [String : Any]
        let builder = DTHTMLAttributedStringBuilder(html: encodedData, options: options, documentAttributes: nil)
        var returnValue: NSAttributedString?
        returnValue = builder?.generatedAttributedString()
        if returnValue != nil {
          // needed to show link highlighting
          let mutable = NSMutableAttributedString(attributedString: returnValue!)
          mutable.removeAttribute(NSAttributedString.Key.foregroundColor, range: NSMakeRange(0, mutable.length))
          return mutable
        } else {
          return NSMutableAttributedString(string: "")

    Call site:

              fontFamily: "SF Text",
              fontName: "SF Text Regular",
              fontSize: 17,
              textColor: .label,
              textAlignment: .left

    Also I want to use default apple font that comes with the system, I am using "SF Text" for fontFamily and "SF Text Regular" for fontName, is this correct? or if there is a way to omit the parameters and automatically use the system font.

    opened by FaroukZeino 0
  • Switch to Secure Object Archiving APIs

    Switch to Secure Object Archiving APIs


    Created this issue to address the vulnerability with using NSCoding. The NSCoding does not verify the type of object upon deserialization and therefore is vulnerable to object substitution attacks.

    To mitigate this vulnerability, Apple introduced the NSSecureCoding protocol along with the following secure methods of NSKeyedArchiver and NSKeyedUnarchiver, which are robust against this type of attack:

    // Secure NSKeyedUnarchiver methods
    - (instancetype)initForReadingFromData:(NSData *)data error:(NSError **)error;
    + (id)unarchivedObjectOfClass:(Class)cls fromData:(NSData *)data error:(NSError **)error;
    + (id)unarchivedObjectOfClasses:(NSSet<Class> *)classes fromData:(NSData *)data error:(NSError **)error;
    // Secure NSKeyedArchiver methods
    - (instancetype)initRequiringSecureCoding:(BOOL)requiresSecureCoding;
    + (NSData *)archivedDataWithRootObject:(id)object requiringSecureCoding:(BOOL)requiresSecureCoding error:(NSError **)error;

    Apple provides more information in the WWDC20 session, 'Securing Your App'.

    The places where unsecure NSKeyedArchiver and NSKeyedUnarchiver is called :

    opened by guraghav 0
  • Nested list render issue

    Nested list render issue

    Regardless of ordered list/unordered list, when the text is too long, the first line will always be wrapped

    Sample Html: <html><body style=\"line-height: 19.0px\"><ul style=\"list-style-type:\'disc\'\"><li>abcdefghijkl<ul style=\"list-style-type:\'disc\'\"><li>abcdefghijkl21321321321362152632165sdadsadsad<ul style=\"list-style-type:\'disc\'\"><li>sadasd<ul style=\"list-style-type:\'disc\'\"><li>wqewqeasdasdasdasdasdasdasd</li></ul></li><li>sadasd</li><li>sadsadasdasdasdfasfdasfdsadasdasd</li></ul></li><li>abcdefghijklsd</li><li>abcdefghijkls</li><li>abcdefghijkl</li><li>abcdefghijkl</li><li>abcdefghijkl</li></ul></li><li>abcdefghijkl</li><li>abcdefghijkl</li><li>abcdefghijkl</li><li>abcdefghijkldsfsdgfdgdgfdsgsdfgsdfgsfdgsdgsdgsdgdsgsd</li></ul></body></html>

    Result: Simulator Screen Shot - iPhone SE (3rd generation) - 2022-05-23 at 09 33 25

    opened by yanweida99 0
  • DTAttributedTextContentView will cause Zombie layer object crash when Using DTTiledLayerWithoutFade

    DTAttributedTextContentView will cause Zombie layer object crash when Using DTTiledLayerWithoutFade

    @odrobnik Can you do me a favour to look at this problem? This crash bothered my project for years , and I don't know how to fix it

    the problem seems like when DTAttributedTextContentView 's layer is using DTTiledLayerWithoutFade, any subview added to DTAttributedTextContentView will be deallocated unexpected when the whole tableview deallocating . and this will cause some crash. image

    I reproduce the crash with the official example of DTCoreText, You guys can see the commit here:

    opened by ximmyxiao 11
  • Crash calculating the bounding rect on iOS 15

    Crash calculating the bounding rect on iOS 15

    Using Xcode 13.3 and the iOS 15 SDK, when I do the following

            let maxSize = CGSize(width: width, height: .greatestFiniteMagnitude)
            let size = attributedString.boundingRect(with: maxSize,
                                         options: [.usesLineFragmentOrigin, .usesFontLeading],
                                         context: nil)

    I get an unrecognized selector crash.

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DTImageTextAttachment attachmentBoundsForAttributes:location:textContainer:proposedLineFragment:position:]: unrecognized selector sent to instance 0x6000031514d0'

    Googling this error, I don't get a lot of hits, but it looks like maybe this was new API added in iOS 15? Is that something that needs to be added to DTCoreText to work properly with iOS 15?

    opened by jaylyerly 7
  • 1.6.26(Jun 30, 2021)

    • FIXED: Some weak support issues
    • FIXED: Some warnings
    • FIXED: Enabled bitcode
    • FIXED: Missing weak for DTAccessibilityElement and view proxy
    • FIXED: [Demo] About VC didn't set correct content inset
    • FIXED: Select correct fallbackFont with matching traits when multiple are available
    • FIXED: Check for default font
    • NEW: [Demo] Demonstrate dark/light mode adjustment on About Box


    Source code(tar.gz)
    Source code(zip)
  • 1.6.25(Oct 9, 2020)

    • FIXED: URLs containing CJK characters are not parsed
    • FIXED: iOS 13 openURL crash
    • FIXED: References to deprecated classes
    • FIXED: Cannot parse CSS with empty font-family
    • FIXED: iOS 14 warnings
    • NEW: Swift Package Manager Support


    Source code(tar.gz)
    Source code(zip)
  • 1.6.24(Aug 24, 2020)

  • 1.6.23(Sep 11, 2019)

  • 1.6.22(Sep 11, 2019)

  • 1.6.21(Aug 28, 2017)

    • ADDED: Support for


    • ADDED: Support width attribute in percent for text attachments
    • ADDED: Ability to abort HTML parsing
    • ADDED: Archiving
    • ADDED: Improved support for macOS
    • FIXED: Incorrect file name in import should be DTCSSStylesheet.h
    • FIXED: HTML generation with multi-line links
    • FIXED: Do not add 'Apple-converted-space' to attributed string when processing custom HTML attributes
    • FIXED: Ignore list style shorthands that are not strings
    • FIXED: Wrong attributed substring passed to generic custom view when using truncation
    • FIXED: Avoid unnecessary drawing of DTAttributedTextContentView if it is being deallocated
    • FIXED: Changing properties on DTCoreTextLayoutFrame would not update layout, resulting in incorrect sizing information being returned


    Source code(tar.gz)
    Source code(zip)
  • 1.6.20(Feb 23, 2017)

    • FIXED: Crash when img tag had an invalid file URL to an animated GIF
    • FIXED: Superfluos import for framework-based umbrella header causing build issues
    • FIXED: Link will be nil when cleanString contains Chinese characters
    • FIXED: DTCoreTextLayoutFrame memory leak
    • FIXED: Certain truncations might cause a crash
    • FIXED: Skip unpaired bracket } & fix NSUInteger underflow in CSS parser
    • FIXED: Space to “apple converted space span” conversion for 2 spaces
    • FIXED: Text range for text block (for drawing background rectangle) might be computed incorrectly
    • FIXED: Crash with IFRAME src attribute had less than 2 characters
    • ADDED: Look for DTCoreTextFontOverrides.plist in the main bundle if its not found in the local bundle
    • ADDED: Expanded character decoding support in stringByReplacingHTMLEntities


    Source code(tar.gz)
    Source code(zip)
  • 1.6.19(Oct 11, 2016)

    • FIXED: Incompatibility with iOS 7, using containsString
    • FIXED: Memory Leak in DTLazyImageView, using NSURLSession
    • FIXED: [Demo] When loading remote images the relayout needs to be done on next runloop
    • FIXED: Incorrect tabulator used for list items
    • FIXED: In default.css P tags had a -webkit-margin-before (which gets parsed since 1.6.18) causing superfluous extra space before paragraphs


    Source code(tar.gz)
    Source code(zip)
  • 1.6.18(Sep 30, 2016)

    • ADDED: tvOS Support
    • ADDED: Property to better support display remote images with DTAttributedTextCell
    • ADDED: Extension sub spec (which removes some things that cannot be used in Extensions)
    • ADDED: Parse margin-top as paragraphSpacingBefore
    • ADDED: Support for list style with roman numerals
    • ADDED: 10% performance increase parsing CSS styles that only have a single part
    • ADDED: Usage of custom font name via CSS in programming guide
    • FIXED: Potential crash on iOS 10 from more strict CoreText functions
    • FIXED: Crash when list-style-image was not a string
    • FIXED: Crash when comparing lines and one of them was nil
    • FIXED: Several Xcode 8 build warnings
    • FIXED: All deprecation warnings related to CoreText text alignment constants
    • FIXED: NSURLConnection deprecation by using NSURLSessionDataTask instead
    • FIXED: Deprecation warnings related to percentEncoding, replaced with HTML entity encoding
    • FIXED: Several Carthage build problems


    Source code(tar.gz)
    Source code(zip)
  • 1.6.17(Jan 8, 2016)


    • ADDED: Line truncation
    • ADDED: Minimum and maximum line heights
    • ADDED: Ability to change paragraph tag name
    • ADDED: Support for use in app extension
    • FIXED: Build error for integrating via sub-project
    • FIXED: CTLineUtils compiler warnings
    • FIXED: Setup Guide for sub-project integration
    • FIXED: Missing paragraph style for text attachments
    • CHANGED: Updated to DTFoundation 1.6.9


    Source code(tar.gz)
    Source code(zip)
  • 1.6.16(Jul 7, 2015)

    • FIXED: Compatibility with CocoaPods 0.36 and frameworks
    • FIXED: Missing super calls in -awakeFromNib
    • FIXED: Dependency problems with DTWeakSupport.h
    • FIXED: Problem with "Cursive" tag and a Custom Font Cursive
    • FIXED: CGFloat values were used as bool values within if statements
    • FIXED: Additional CGFloat build issue on xCode 7
    • FIXED: Wrong foreground color attribute used for appending NL
    • FIXED: Xcode warning for unused expression result
    • FIXED: CGFloat build issue on xCode 7
    • ADDED: Honour the value of NSBaselineOffsetAttributeName
    • ADDED: DTCoreText.framework for iOS
    • ADDED: Improve AutoLayout in DTAttributedTextContentView
    • ADDED: DTDocumentPreserveTrailingSpaces boolean option


    Source code(tar.gz)
    Source code(zip)
  • 1.6.15(Feb 19, 2015)

    • FIXED: NULL dereference when CTLineCreateTruncatedLine fails
    • FIXED: UIColor would be set as CTForegroundColor in some cases, causing problems
    • FIXED: Possible exception 'Auto Layout still required after executing -layoutSubviews.'
    • CHANGED: Use defaultParagraphStyle rather than assert crash for DTUseiOS6Attributes option
    • CHANGED: DTFoundation updated to 1.7.5 (few minor fixes for DTHTMLParser)


    Source code(tar.gz)
    Source code(zip)
  • 1.6.14(Oct 17, 2014)

    • FIXED: Parsing 2x Image in data URL causes it to double in size
    • FIXED: In Demo app, image elements seem to block scrolling in iOS 8
    • FIXED: Missing Helvetica Neue Italic font in iOS 7.0.x would cause crash
    • FIXED: Potential memory leak in -newMatchingFont
    • FIXED: Potential crash from iOS bug, calling -accessibilityElementAtIndex: with non-existing index
    • ADDED: Override -coretext-fontname to use direct "PostScript" names for fonts


    Source code(tar.gz)
    Source code(zip)
  • 1.6.13(Jul 7, 2014)

    • FIXED: Traditional margin-* style value following -webkit-margin-* reset margin values to 0
    • FIXED: iOS 8 crash resulting from Apple making CTRunGetPositionsPtr lazy
    • FIXED: HTML element with text attachment and display:none would emit extra object placeholder
    • FIXED: Child element with display:none would not be ignored when determining if parent needs to be output
    • FIXED: Animated GIF only showing first frame
    • FIXED: DTHTMLWriter does not output attachments
    • FIXED: Some build warnings from Xcode 6
    • CHANGED: Migrated unit testing to XCTest
    • CHANGED: DTFoundation updated to 1.7.1 (for animated GIF support)


    Source code(tar.gz)
    Source code(zip)
  • 1.6.12(Jun 4, 2014)

    • FIXED: Crash parsing background shorthand containing color
    • FIXED: Broken unit test for uncompressing background shorthand
    • FIXED: DTAttributeLabel doesn't use delegate methods to render text from truncationString param
    • FIXED: Links parsed from HTML are not recognized in UITextView (using NS-style attributes)
    • FIXED: Memory leak in -CGColor method on MacOSX target.
    • FIXED: lineHeightMultiple not being transferred to NSParagraphStyle
    • FIXED: Warnings related to disparities between properties and ivars
    • FIXED: Build issues because submodule did not include 32-bit slice
    • FIXED: Crash on iOS 5 due to unguarded selector calling
    • FIXED: Warning about deprecated methods using deployment target >= iOS 7
    • ADDED: Ability to specify default font face name
    • CHANGED: Updated DTFoundation to 1.7.0


    Source code(tar.gz)
    Source code(zip)
  • 1.6.11(Mar 18, 2014)

    FIXED: Crash on 64-bit CPU if an element had no foreground color FIXED: CGColor sanity check randomly fails FIXED: Implicit conversion warnings in DTHTMLWriter FIXED: Analyzer warnings in DTHTMLWriter FIXED: Compatibility of NSColor for deployment targets prior to OS X 10.8 FIXED: Various documentation fixes CHANGED: Manual drawing of underlines removed as of iOS 7 CHANGED: Completeness of AppleDoc comments now part of unit tests ADDED: Options parameter to setting HTML string convenience method on DTAttributedTextCell ADDED: Support for CSS "background" shorthand ADDED: Screenshot button to Demo app ADDED: NSCoding support for DTTextAttachment, DTTextBlock and DTCSSListStyle


    Source code(tar.gz)
    Source code(zip)
  • 1.6.10(Mar 18, 2014)

    • FIXED: 64-bit macros for creating an NSNumber from CGFloat
    • FIXED: Path in podspec prepare_command breaks if CDPATH defined in shell
    • DOCS: Added explanation for lazy image loading to programming guide
    • ADDED: Support for border-color, -radius, -width for use with TTAttributedLabel
    • CHANGED: Updated DTFoundation to 1.6.1


    Source code(tar.gz)
    Source code(zip)
  • 1.6.9(Jul 4, 2015)

    • FIXED: Repackage headers needed from DTFoundation to static universal and Mac frameworks
    • FIXED: Duplicate symbol when using DTCoreText together with DTTransition pod
    • FIXED: Compiler warnings
    • FIXED: iOS 6-style attributes would not work on iOS 6 simulator
    • FIXED: Renamed instances of "class" to avoid conflict with C++ reserved word
    • FIXED: Method to set fallback font family would allow setting of invalid font family name
    • FIXED: Crash in DTAttributedTextContentView related to text box range finding
    • ADDED: BundleLoaderDummy to allow unit-testing code dealing UIFont
    • ADDED: arm64 support
    • ADDED: ability to determine attributed string size with unknown width
    • CHANGED: Updated DTFoundation requirement to 1.6.0


    NOTE: The CGFLOAT_OPEN_HEIGHT constant has been renamed to CGFLOAT_HEIGHT_UNKNOWN.

    Source code(tar.gz)
    Source code(zip)
  • 1.6.8(Oct 4, 2013)

    • ADDED: VIDEO tag with no direct SRC attribute will now use the first one from its child-tags
    • ADDED: support for letter-spacing CSS style (mapped to kerning)
    • ADDED: Proper nested lists support in DTHTMLWriter
    • ADDED: Code coverage support
    • FIXED: Resizing behavior of DTLazyImageView
    • FIXED: Potential dead-lock in [DTAttributedTextContentView layoutFrame]
    • FIXED: HTML with lists might trigger a crash because an NSArray was mutated while being enumerated
    • FIXED: Output of nested lists was broken
    • FIXED: Elusive crash related to text blocks
    • FIXED: a situation where some whitespace does not get trimmed correctly
    • FIXED: CSS inheritance would clash mit direct inheritance of DTHTMLElements
    • FIXED: The "not-found range" {NSNotFound,0} was used incorrectly in several spots
    • CHANGED: Replaced instances of using DTVersion for runtime version checking with method recommended by Apple
    • CHANGED: Requires DTFoundation 1.5.4


    Source code(tar.gz)
    Source code(zip)
  • 1.6.7(Oct 4, 2013)

    • FIXED: Paragraphs within list items render incorrectly
    • FIXED: Reformatting URLs embedded in iframe for YouTube
    • FIXED: Performance degradation when using padding in iOS 7
    • FIXED: Crash when using iOS6 Attributes and Drawing Underline on iOS 7
    • FIXED: Crash on iOS6 caused by DTAttributedTextCell iOS 7 workaround
    • FIXED: Indenting for DTAttributedTextCell when used in grouped tableview
    • FIXED: DTHTMLWriter does not output inline styles for UL/OL
    • FIXED: DTHTMLWriter outputs empty span tag following LI
    • FIXED: background-color is not transferred from UL style to LI
    • ADDED: Option to skip font setup for use-cases not requiring CSS parsing
    • ADDED: Tab stop support in modern attributes’ NSParagraphStyle
    • CHANGED: Moved hex methods for color into DTColorFunctions


    Source code(tar.gz)
    Source code(zip)
  • 1.6.6(Oct 4, 2013)

    • FIXED: Out of Memory crash on certain HTML documents extensively using CSS cascading
    • FIXED: CSS Cascading by element name performance problem
    • FIXED: Issue with font-size doubling in some situations due to CSS selector being applied
    • FIXED: Last line in a list might lose the tab stops
    • FIXED: glyph run has wrong stringRange for hyphenated lines
    • FIXED: all failing unit tests
    • ADDED: Single Selector Cascading
    • ADDED: Many unit tests for CSS Cascading
    • ADDED: Travis-CI for automated testing of pull requests
    • CHANGED: CSS selector matching now evaluates specificity


    Source code(tar.gz)
    Source code(zip)
  • 1.6.5(Oct 4, 2013)

    • FIXED: Crash encountering empty text block
    • FIXED: Crash encountering ARGB color in CSS
    • ADDED: More general support for CSS cascading
    • ADDED: Programming Guide
    • ADDED: Documentation for enums


    Source code(tar.gz)
    Source code(zip)
  • 1.6.4(Oct 4, 2013)

    • FIXED: Crash when having multiple font-families in the default style sheet
    • FIXED: Crash when encountering multiple font-families in one CSS style during parsing
    • FIXED: Specifying multi font-family entries does not find correct family if fall-back families are specified
    • FIXED: Race condition when using DTTextBlocks together with Tiled Layer
    • CHANGED: Removed CTParagraphStyle caching
    • ADDED: Workaround for rdar://14684188 (iOS 7)
    • ADDED: Adjust content inset in Demo for iOS 7
    • ADDED: Proper indenting of stacked text boxes
    • ADDED: Support for cascading CSS classes


    Source code(tar.gz)
    Source code(zip)
  • 1.6.3(Oct 4, 2013)

    • FIXED: Some UIKit calls might be occurring on background thread in DTLazyImageView
    • FIXED: Performance problem parsing HTML that had many encoded entities
    • FIXED: Typo in DTAttributedTextView’s contentViewDidLayout
    • FIXED: DTAttributedTextCell Crash on future iOS version
    • CHANGED: CSS Attribute Parser improved to better deal with multi-value attributes
    • CHANGED: Updated DTFoundation to 1.5.1
    • CHANGED: Updated pod spec for CocoaPods 0.23


    Source code(tar.gz)
    Source code(zip)
  • 1.6.2(Oct 4, 2013)

    • FIXED: Unable to run Demo App due to missing symbols
    • FIXED: Random issues with CocoaPods setup where DTHTMLParser subspec could not be found
    • FIXED: Hyphenated line has incorrect stringRange
    • FIXED: LineCreateJustifiedLine sometimes fails if the line ends with soft hyphen


    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Oct 4, 2013)

    • FIXED: [DTHTMLWriter] did not output span styles (like background color) in fragment mode
    • FIXED: DTHTMLWriter did not output name of anchors if present
    • FIXED: DTHTMLWriter output base URL even if href property was nil
    • FIXED: DTTextAttachmentDrawing fixed to have non-flipped coordinate system
    • FIXED: Rotated images would show incorrectly oriented in DTTextAttachmentDrawing
    • ADDED [SPONSORED]: Method to determine string index based on touch coordinates
    • ADDED [SPONSORED]: DemoApp demonstrates getting the range of a tapped word
    • ADDED: DemoApp now has toggle to display output of DTHTMLWriter in fragment and document modes
    • CHANGED: Made processing of custom HTML Attributes optional, via new parsing option


    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Oct 4, 2013)

    • CHANGED: The algorithm to place lines during typesetting is completely revamped. It is now modeled after how Safari does it.
    • ADDED: Basic Voice Over support
    • ADDED: Support for soft hyphens
    • ADDED: Delegate method that gets called before text is drawn so that you can draw beneath it
    • ADDED [SPONSORED]: Support for custom HTML attributes on text
    • FIXED: new typesetting algorithm fixes several issues with wildly changing line heights
    • FIXED: new typesetting algorithm fixes line height on wrapping lines
    • FIXED: new typesetting algorithm fixes line positioning using fixed line height in combination with text attachments
    • FIXED: DTHTMLWriter would emit multiple A tags if format changed inside the hyperlink


    Source code(tar.gz)
    Source code(zip)
  • 1.5.3(Oct 4, 2013)

    • FIXED: When encountering an unknown font family a NULL font would be returned, causing crashes in connection with lists
    • FIXED: Strings with attachments would not get a font assigned when using DTCoreText via CocoaPods
    • FIXED: DTHTMLWriter now properly escapes tab characters found in attributed strings
    • FIXED: Crash when encountering characters post end of closing HTML tag
    • FIXED: Loading available fonts into override table would lock on synchronize, causing a long delay for parsing
    • FIXED: sizeThatFits would return incorrect value for empty string
    • FIXED: Position of highlighting on RTL text was incorrect
    • ADDED: Delegates are now using zeroing weak references if permitted by the deployment target setting
    • ADDED: Documentation for DTTextAttachment to note that parsed attributes are lower-case
    • UPDATED: DTFoundation to 1.4.3


    Source code(tar.gz)
    Source code(zip)
  • 1.5.2(Oct 4, 2013)

    • FIXED: Crash on parsing HTML with additional tags following HTML end tag
    • FIXED: DTAttributedLabel problems being instantiated from NIB, ignoring edge insets
    • FIXED: Crash on using font-family “inherit” together with font-variant “small-caps”.
    • FIXED: Endless loop when using a text block that would not fully fit in a height-constrained layout frame
    • FIXED: Image Attachment ignoring maximum display size if width/height are set via tag attributes
    • FIXED: Invalid font-size would cause Core Text font size of 12px to be used.
    • [Sponsored] CHANGED: Lists now correctly use padding and margin. If you specify too small a margin for the list prefix to fit, then the list prefix is omitted.


    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Oct 4, 2013)

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

Pavel Sharanda 1.1k Jan 8, 2023
Easily show RichText(html) in SwiftUI

RichText LightMode DarkMode Code import SwiftUI

null 82 Jan 7, 2023
An Objective-C framework for converting Markdown to HTML.

MMMarkdown MMMarkdown is an Objective-C framework for converting Markdown to HTML. It is compatible with OS X 10.7+, iOS 8.0+, tvOS, and watchOS. Unli

Matt Diephouse 1.2k Dec 14, 2022
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Twitter 2.9k Dec 27, 2022
A Swift framework for using custom emoji in strings.

Emojica – a Swift framework for using custom emoji in strings. What does it do? Emojica allows you to replace the standard emoji in your iOS apps with

Dan 101 Nov 7, 2022
A Github action for creating generic run report using Markdown

create-report A Github action for creating generic run report (using Markdown!) - uses: michaelhenry/[email protected] with: report-title: "

Michael Henry 4 Apr 19, 2022
SwiftUI TextEdit View - A proof-of-concept text edit component in SwiftUI & CoreText.

A proof-of-concept text edit component in SwiftUI & CoreText. No UIKit, No AppKit, no UITextView/NSTextView/UITextField involved.

Marcin Krzyzanowski 80 Dec 1, 2022
A result builder that build HTML parser and transform HTML elements to strongly-typed result, inspired by RegexBuilder.

HTMLParserBuilder A result builder that build HTML parser and transform HTML elements to strongly-typed result, inspired by RegexBuilder. Note: Captur

null 4 Aug 25, 2022
🌊 Let your code flow. Extension methods for fluent syntax in Swift.

Flow ?? Let your code flow. This library provides a bunch of extension methods for a better fluent syntax in Swift. This style is very useful for some

Alejandro Martínez 100 Nov 30, 2022
Extension of Diffable API which allow not duplicate code and use less models. Included example for SideBar.

SPDiffable Apple's diffable API requerid models for each object type. If you want use it in many place, you pass many time to implemenet and get over

Ivan Vorobei 114 Jan 3, 2023
Convenience methods for creating color using RGBA hex string.

UIColor+Hex, now Swift. Convenience method for creating autoreleased color using RGBA hex string.

R0CKSTAR 1.2k Dec 23, 2022
A wrapper around UICollectionViewController enabling a declarative API around it's delegate methods using protocols.

Thunder Collection Thunder Collection is a useful framework which enables quick and easy creation of collection views in iOS using a declarative appro

3 SIDED CUBE 4 Nov 6, 2022
Erik is an headless browser based on WebKit. An headless browser allow to run functional tests, to access and manipulate webpages using javascript.

Erik Erik is a headless browser based on WebKit and HTML parser Kanna. An headless browser allow to run functional tests, to access and manipulate web

Eric Marchand 544 Dec 30, 2022
Push notifications allow developers to reach users, even when users aren't actively using an app!

Push notifications allow developers to reach users, even when users aren't actively using an app! With the latest update of iOS Apple provide very useful extensions which are user-friendly. In this tutorial, I am going to share the configuration, set up of Notification with the media attachments like.

MindInventory 16 Mar 3, 2022
An awesome Swift HTML DSL library using result builders.

SwiftHtml An awesome Swift HTML DSL library using result builders. let doc = Document(.html5) { Html { Head { Meta()

Binary Birds 204 Dec 25, 2022
Erik is an headless browser based on WebKit. An headless browser allow to run functional tests, to access and manipulate webpages using javascript.

Erik Erik is a headless browser based on WebKit and HTML parser Kanna. An headless browser allow to run functional tests, to access and manipulate web

Eric Marchand 544 Dec 30, 2022
Input Validation Done Right. A Swift DSL for Validating User Input using Allow/Deny Rules

Valid Input Validation Done Right. Have you ever struggled with a website with strange password requirements. Especially those crazy weird ones where

Mathias Quintero 37 Nov 3, 2022
Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, configurations and app-state.

Prephirences - Preϕrences Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, co

Eric Marchand 557 Nov 22, 2022
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.

Luminous Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8+ Swift 5 Xcode 1

Andrea Mario Lufino 324 Nov 27, 2022
SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

Gymshark 1 Jul 6, 2021