From c1fe086a82a3a39b7ad9111f4e15506efd8ed2da Mon Sep 17 00:00:00 2001 From: Daniel Saidi Date: Mon, 4 Mar 2024 09:49:09 +0100 Subject: [PATCH] Add text view abstraction --- .../RichTextKit.docc/RichTextKit.md | 5 ++++ .../RichTextKit/TextViewRepresentable.swift | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Sources/RichTextKit/TextViewRepresentable.swift diff --git a/Sources/RichTextKit/RichTextKit.docc/RichTextKit.md b/Sources/RichTextKit/RichTextKit.docc/RichTextKit.md index 24ec6c6a5..ad6f577cb 100644 --- a/Sources/RichTextKit/RichTextKit.docc/RichTextKit.md +++ b/Sources/RichTextKit/RichTextKit.docc/RichTextKit.md @@ -139,6 +139,10 @@ RichTextKit is available under the MIT license. See the [LICENSE][License] file - ``RichTextKeyboardToolbarMenu`` - ``RichTextKeyboardToolbarStyle`` +### Line + +- ``RichTextLine`` + ### Localization - ``RTKL10n`` @@ -169,6 +173,7 @@ RichTextKit is available under the MIT license. See the [LICENSE][License] file ### Views - ``RichTextLabelValue`` +- ``TextViewRepresentable`` diff --git a/Sources/RichTextKit/TextViewRepresentable.swift b/Sources/RichTextKit/TextViewRepresentable.swift new file mode 100644 index 000000000..582f98a68 --- /dev/null +++ b/Sources/RichTextKit/TextViewRepresentable.swift @@ -0,0 +1,27 @@ +// +// TextViewRepresentable.swift +// RichTextKit +// +// Created by Daniel Saidi on 2024-03-04. +// Copyright © 2024 Daniel Saidi. All rights reserved. +// + +#if macOS +import AppKit + +/** + This typealias bridges platform-specific text views to make + it easier to support multi-platform. + */ +public typealias TextViewRepresentable = NSTextView +#endif + +#if iOS || os(tvOS) || os(visionOS) +import UIKit + +/** + This typealias bridges platform-specific text views to make + it easier to support multi-platform. + */ +public typealias TextViewRepresentable = UITextView +#endif