After 4 years with Apple's TextKit 2: The promised 'better' text engine has unstable scrolling, unreliable height estimates, and viewport issues so bad that even Apple's TextEdit suffers from them. Good architecture, but the implementation makes it frustratingly difficult for real-world apps.…
Local unit tests with Xcode
Put unit tests next to tested Swift code, and run tests from the same Xcode target.…
CoreText Swift Academy - part 3
In Part 2 [https://blog.krzyzanowskim.com/2020/07/10/coretext-swift-academy-part-2/], I discussed selected font metrics. Now let's see how to layout text line or lines. Text Layout Text layout is non-trivial task. CoreText provides handful of useful functions to layout text in a rectangle frame, or along…
CoreText Swift Academy - part 2
In Part 1 [https://blog.krzyzanowskim.com/2020/07/09/coretext-academy-part-1/], I created a label view, where I draw a text in it. Now let's see what happened there: Font & Attibuted String How about font? Font is important part of drawing text. CoreText relies on Attributed String.…
CoreText Swift Academy - part 1
Ever wanted to layout letters? implement label view? create text edit component from the ground? bear with me. CoreText is low-level framework for laying out text and handling fonts. Low level like "C language level low", but also like "Font glyph level low". What CoreText can:…