Account auto-completion has arrived in #Oliphaunt!

Start typing @ in the composer and you’ll get a native-style auto-completion window — right at the caret, just like in Xcode. No clunky bars or overlays — this is proper #Mac behaviour.

It’ll be available in the next build.
Is #Oliphaunt the first Mastodon client to do it like this?

#TextKit #TextKit2 #NSTextView #Cocoa #AppKit #Swift #SwiftUI #macOS #MacDev #macOSDev

I’ve upgraded the toot composer in #Oliphaunt 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.

#TextKit #TextKit2 #NSTextView #Cocoa #AppKit #Swift #SwiftUI #macOS #MacDev #macOSDev #Mac

Anybody here know anything about fonts? I'm having an issue with the New York system font reporting different sizes across devices. I suspect my setup, yet I have no idea where this could come from 😭

https://developer.apple.com/forums/thread/768861

Happy for any ideas or hints. Also let me know in which camp you are. I suspect the first output being the „correct one", yet I don't know for sure.

#appkit #nsfont #textkit

Inconsistent "New York" font retur… | Apple Developer Forums

One of the coolest things I can create with DeclarativeTextKit and a syntax tree in #Swift and #TextKit is this:

Use the same shortcut (here: ⌘B for Markdown bold face) to

1) embolden a selection,
2) or embolden word-at-point
3) or remove bold markup around point or inside of the selection
4) or combine 2+ bold spans into one

The transformations are very simple to write. One to remove, one to add asterisks.

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:

1) find existing inline token ranges

2) remove the markup pieces (backticks, parens, brackets, asterisks, underscores, ...) from all occurrences in the selected range (expanded to full "words")

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

#textkit

🏁 Milestone reached!

This "Inline Code" shortcut implementation

1. detects all existing inline code spans in the document
2. removes their backticks
3. wraps the result in a new pair of backticks.

All in 27 lines of code 🎉

(And many hundred lines of text mutation library and token tree traversal)

#swift #textkit #markdown

It lives, and it works!

https://github.com/CleanCocoa/DeclarativeTextKit/blob/main/Tests/DeclarativeTextKitTests/UseCaseTests.swift

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.

#textkit #swift

DeclarativeTextKit/Tests/DeclarativeTextKitTests/UseCaseTests.swift at main · CleanCocoa/DeclarativeTextKit

Swift DSL to perform mutations on e.g. NSTextViews in a declarative style. - CleanCocoa/DeclarativeTextKit

GitHub

Performant #macOS TextView with line numbers and much more. (NSTextView replacement) #swiftlang #textkit

Release 0.4.0 📦

https://github.com/krzyzanowskim/STTextView

GitHub - krzyzanowskim/STTextView: Performant and reusable text view component (TextKit 2), with line numbers and more. UITextView / NSTextView replacement.

Performant and reusable text view component (TextKit 2), with line numbers and more. UITextView / NSTextView replacement. - krzyzanowskim/STTextView

GitHub
Have been working on #TextKit 2 on #iOS for two full months, time to switch context to another mysterious framework #EventKit 😅

another #TextKit 2 issue added to the list FB11898356

https://github.com/krzyzanowskim/STTextView#bug-reports-list

Reproduced with Apple provided Sample project. The selection API is buggy. Looks like I need to reimplement it to make it work #iosdev #macdev

GitHub - krzyzanowskim/STTextView: Performant and reusable text view component (TextKit 2), with line numbers and more. UITextView / NSTextView replacement.

Performant and reusable text view component (TextKit 2), with line numbers and more. UITextView / NSTextView replacement. - krzyzanowskim/STTextView

GitHub