sigmoid.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A social space for people researching, working with, or just interested in AI!

Server stats:

588
active users

#textkit

0 posts0 participants0 posts today
Ammad<p>I’ve upgraded the toot composer in <a href="https://mastodon.social/tags/Oliphaunt" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Oliphaunt</span></a> to use TextKit 2 and improved the custom emoji picker — it now appears right at the caret position! I’m really pleased with how this turned out.</p><p><a href="https://mastodon.social/tags/TextKit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TextKit</span></a> <a href="https://mastodon.social/tags/TextKit2" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TextKit2</span></a> <a href="https://mastodon.social/tags/NSTextView" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>NSTextView</span></a> <a href="https://mastodon.social/tags/Cocoa" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Cocoa</span></a> <a href="https://mastodon.social/tags/AppKit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>AppKit</span></a> <a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> <a href="https://mastodon.social/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> <a href="https://mastodon.social/tags/macOS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOS</span></a> <a href="https://mastodon.social/tags/MacDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>MacDev</span></a> <a href="https://mastodon.social/tags/macOSDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOSDev</span></a> <a href="https://mastodon.social/tags/Mac" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Mac</span></a></p>
Christian Tietze<p>One of the coolest things I can create with DeclarativeTextKit and a syntax tree in <a href="https://mastodon.social/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> and <a href="https://mastodon.social/tags/TextKit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TextKit</span></a> is this:</p><p>Use the same shortcut (here: ⌘B for Markdown bold face) to </p><p>1) embolden a selection, <br>2) or embolden word-at-point<br>3) or remove bold markup around point or inside of the selection<br>4) or combine 2+ bold spans into one</p><p>The transformations are very simple to write. One to remove, one to add asterisks.</p>
Christian Tietze<p>The depicted code on its own doesn't make much sense for you, but what I see here is a template for same-ish behavior that I can refactor and reuse:</p><p>1) find existing inline token ranges</p><p>2) remove the markup pieces (backticks, parens, brackets, asterisks, underscores, ...) from all occurrences in the selected range (expanded to full "words")</p><p>3) in cases of italics, bold, and inline code, wrap the result in markup again *if* the intent seems to be to unify 2+ spans into one</p><p><a href="https://mastodon.social/tags/textkit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>textkit</span></a></p>
Christian Tietze<p>🏁 Milestone reached!</p><p>This "Inline Code" shortcut implementation</p><p>1. detects all existing inline code spans in the document<br>2. removes their backticks<br>3. wraps the result in a new pair of backticks.</p><p>All in 27 lines of code 🎉</p><p>(And many hundred lines of text mutation library and token tree traversal)</p><p><a href="https://mastodon.social/tags/swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swift</span></a> <a href="https://mastodon.social/tags/textkit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>textkit</span></a> <a href="https://mastodon.social/tags/markdown" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>markdown</span></a></p>
Christian Tietze<p>It lives, and it works!</p><p><a href="https://github.com/CleanCocoa/DeclarativeTextKit/blob/main/Tests/DeclarativeTextKitTests/UseCaseTests.swift" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/CleanCocoa/Declarat</span><span class="invisible">iveTextKit/blob/main/Tests/DeclarativeTextKitTests/UseCaseTests.swift</span></a></p><p>With this, I can now add wrappers to detect ranges in text buffers based on my AST/token tree information in the app and test-drive everything.</p><p><a href="https://mastodon.social/tags/textkit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>textkit</span></a> <a href="https://mastodon.social/tags/swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swift</span></a></p>