automerge / automerge-swift

Swift language bindings presenting Automerge

Home Page:https://automerge.org/automerge-swift/documentation/automerge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Text as an object conflicts horribly (in usage) with SwiftUI

heckj opened this issue · comments

The Text type, a Swift placeholder type that encapsulates the notion of the collaborative .Text object within Automerge, is poorly named being both a generic name and a type in extremely common use in SwiftUI. (The Text type is intended to vend both String and AttributedString from the underlying Automerge object representation with the upcoming fuller Pretext support.)

While putting together a sample application, I've had to reference the type directly a couple of times - in SwiftUI views no less - which resulted in some really annoying syntax juggling to make sure the compiler knew which Text type I was referring to. It's a breaking change in this API, but it would be a LOT more sane to have a different name for this type.

Variations for names that I've noodled:

  • MultiText
  • CollaborativeString
  • SyncString
  • SyncText
  • MergeString
  • AutomergeString

The type needs a different, non-conflicting name - and the documentation needs relevant updates, including example usage.