RichTextKit will use semver after 1.0.
Until then, minor updates may remove deprecated features and introduce breaking changes.
This release reverts the Swift 6 restriction.
The library is still ready for Swift 6, but will not require it due to compatibility issues.
This version lets you keep using RichTextKit with Xcode 15.
This release makes RichTextKit use Swift 6.
This will involve a few breaking changes, but they are so minor that they (hopefully) didn't warrant a major version bump.
Reach out if you think that this version changes too much for a minor bump, or if you see any Swift 6 changes you don't agree with.
RichTextAction
has a newdeleteSelectedText
action.RichTextAction
has a newdeleteText(at:)
action.RichTextAction
has a newreplaceSelectedText(with:)
action.RichTextAction
has a newreplaceText(at:with:)
action.RichTextView
has a newdeleteText(at:)
function.RichTextView.Configuration
has a newisScrollBarsVisible
property for macOS.
- Many protocols now use
@preconcurrency @MainActor
. - All mutable
Image
andColor
extensions are now computed. - All standard style and configuration values are now computed.
RichTextView
only sets image configuration if it's not manually set before.
This release removes all deprecated code and cleans up the library.
-
There are new view style and config modifiers for components.
-
RichTextFormat
is a new namespace with format types and views. -
RichTextContext
has more intuitive ways to paste text content. -
RichTextContext
has a new observableparagraphStyle
property. -
RichTextInsertion
has new static convenience insertion builders. -
RichTextViewer
is a new SwiftUI view that can be used to view rich text.
RichTextView
no longer resets font and styles when setting up the macOS text view.
-
All previously deprecated code has been deleted.
-
Many localization keys have been renamed to be easier to use.
-
RichTextContextFocusedValueKey
is renamed toRichTextContext.FocusedValueKey
. -
RichTextEditor
is now configured and styled with modifiers instead of the init. -
RichTextFont
pickers are now configured with a shared modifier instead of the init. -
RichTextFont
size picker is now configured with a shared modifier instead of the init. -
RichTextFormat
components are now configured with a shared modifier instead of the init. -
RichTextFormatSheet
has been renamed toRichTextFormat.Sheet
to trim SDK surface area. -
RichTextFormatSidebar
has been renamed toRichTextFormat.Sidebar
to trim SDK surface area. -
RichTextFormatToolbar
has been renamed toRichTextFormat.Toolbar
to trim SDK surface area. -
RichTextLine.SpacingPicker
is now configured with a shared view modifier instead of the init. -
RichTextKeyboardToolbar
is now configured and styled with two view modifiers instead of the init.
This release adds a lot of new RichTextAction
cases and adjusts the context and coordinator subscription.
This release also deprecates RichTextAttributeReader
and RichTextAttributeWriter
functionality that are not used by the library, in favor of RichTextViewComponent
, to reduce the complexity of the library.
Until now, these functions mostly did the same thing, but sometimes the RichTextViewComponent
have to use its text storage or layout manager, or update the typing attributes. This caused the code to diverge and mostly identical copies had co-exist, where the reader and writer versions were not even used by the library.
By deprecating these functions, we can simplify the library in 1.0, and focus more on unifying the different RichTextViewComponent
implementations (UITextView
in iOS and NSTextView
in macOS), rather than providing a low level string handling interface.
FontRepresentable
has new extensions.RichTextAction
has a newlabel
property.RichTextCommand.ActionButtonGroup
has new inits.RichTextCommand.FormatMenu
is a lot more configurable.RichTextFormatSheet
is now available on all platforms.RichTextFormatSheet
has new configuration and style types.RichTextFormatSidebar
has new configuration and style types.RichTextFormatToolbar
is a new rich text formatting toolbar.RichTextKeyboardToolbar
has a new config to always be shown.RichTextLine
is a new namespace with support for linespacing.RichTextStyle.Button
now supports using custom button styles.RichTextView
has a new theme that lets you define its style.RichTextViewComponent
has a newhasRichTextStyle
function.RichTextViewComponent
has a newtoggleRichTextStyle
function.RichTextViewComponent
now handles superscript changes properly.
RichTextFormatToolbar
is no longer navigation wrapped by default.RichTextFormatToolbar
has a newasSheet()
function that does this.
RichTextColor
icon
is no longer optional.RichTextColor
has a newtitleKey
property.RichTextContext
makes coordinator handle alignment.RichTextCoordinator
now syncs an extra time at ends editing.
-
The library once again builds on visionOS.
-
RichTextAlignment
now behaves better. -
RichTextAlignment.Picker
now uses provided values. -
RichTextCoordinator
now handles indentation changes.
RichTextAttributeReader
has deprecated a lot of functions.RichTextAttributeWriter
has deprecated a lot of functions.RichTextCommand.AlignmentOptionsGroup
has been deprecated.RichTextCommand.FontSizeOptionsGroup
has been deprecated.RichTextCommand.IndentOptionsGroup
has been deprecated.RichTextCommand.StyleOptionsGroup
has been deprecated.RichTextCommand.SuperscriptOptionsGroup
has been deprecated.RichTextContext
replaces individual colors with a singlecolors
.RichTextContext
replaces individual styles with a singlestyles
.RichTextContext
userActionPublisher
is renamed toactionPublisher
.RichTextCoordinator
functions callinghandle(_:)
have been deprecated.RichTextFormatSheet
has been renamed toRichTextFormatToolbar
.RTKL10n.bundle
has been deprecated since we can use the.module
bundle.
RichTextColor.undefined
was no longer used and has been removed.
This release starts moving types and views that relate to other types into the type namespaces, to make the surface area of the library smaller.
RichTextAlignment.Picker
has a new style parameter.RichTextCommand
is a new namespace for command-related views.RichTextColor.Picker
now shows a quick button to reset the color.RichTextLabelValue
is a new protocol that harmonizes label values.
-
Many value types implement
RichTextLabelValue
to get alabel
property. -
All types that implement
RichTextLabelValue
get alabel
that has improved accessibility. -
RichTextColor
.adjust
now takes an optional color. -
RichTextColor
.allCases
no longer returnsundefined
. -
RichTextFormatSheet
no longer hard-codes an accent color. -
RichTextStyle
views no longer use a style - useforegroundStyle
,tint
andaccentColor
instead.
Image.symbol(...)
removespalette
rendering mode to fix incorrect color scheme behavior.RichTextAlignment.Picker
now hides its picker label.RichTextColor.Picker
no longer auto-adjusts black and white to make it possible to actually set those colors.
RichTextAction*
views have been renamed toRichTextAction.Button*
.RichTextAlignment*
views have been renamed toRichTextAlignment.*
.RichTextArgumentReader
deprecates the font name and size functions.RichTextArgumentWriter
deprecates the font name and size functions.RichTextColor*
views have been renamed toRichTextColor.*
.RichTextCommand
views are now nested within the newRichTextCommand
type.RichTextComponent
deprecates the font name and size functions.RichTextDataFormatMenu
has been renamed toRichTextDataFormat.Menu
.RichTextFont*
views have been renamed toRichTextFont.*
.RichTextStyle*
views have been renamed toRichTextStyle.*
.
Thanks to @ropellanda, RichTextKit now supports Vision OS.
Thanks to @screenworker, RichTextEditor now has a config
that can disable scrolling.
Image
has a new rich text-specific image builders.RichTextEditor
has a newconfig
value parameter that can disable scrolling.RichTextView
has a newconfiguration
property that can disable scrolling.
RichTextAction
static properties have been deprecated in favor of their corresponding functions.RichTextReader
.richTextRange
has been renamed to.richTextFullRange
.
RichTextAction
corrects some icons and localized strings.RichTextAttributeReader
now userange
correctly insetRichTextSuperscriptLevel
.RichTextCoordinator
now sets correctunderline
color instead offoreground
color.
RichTextAttributeReader/Writer
functions now require a range.
Thanks to @DominikBucher12, fonts and pasting images behave a lot better than before!
pasteImage(_:at:moveCursorToPastedContent:)
now usestrue
as default move parameter.
Thanks to @DominikBucher12 and @msrutek-paylocity, some bugs have been fixed and some formatting adjusted.
RichTextColor
has a newattribute
property.RichTextColor
has a newunderline
color.RichTextFormatSheet
has a newcolorPickers
init parameter.RichTextFormatSidebar
has a newcolorPickers
init parameter.
RichTextAttributeReader
now allows providing anil
range.RichTextAttributeWriter
now handlessetRichTextStyle
with a switch.RichTextAttributeWriter
andRichTextViewComponent
shares more code.RichTextFormatSheet
now exposes its init params as mutable properties.RichTextFormatSidebar
now handles keyboard focus way better than before.RichTextFormatSidebar
now exposes its init params as mutable properties.RichTextViewComponent
now handlessetCurrentRichTextStyle
with a switch.RichTextViewComponent
now handlessetCurrentRichTextStyle
with a switch.RichTextViewComponent
uses the new colorattribute
to optimize some code.SwiftFormat
now usesconsecutiveSpaces
.
RichTextAttributeWriter
now handlesstrikethrough
with a switch.RichTextView
now handles initial drag & drop better on iOS.
RichTextAttributeReader
color functions are replaced with a singlerichTextColor(_:at:)
.RichTextAttributeWriter
color functions are replaced with a singlesetRichTextColor(_:to:at:)
.
Thanks to @Mcrich23, the RichTextColorPicker
now adjusts foreground and background color for the current color scheme.
RichTextColor
has a new.undefined
type.RichTextColor
has a new color adjust function.RichTextColorPicker
now takes anRichTextColor
.
RichTextColorPicker
now uses the color type icon by default.RichTextColorPicker
now uses the color type color adjustment.
Thanks to @Mcrich23, RichTextKit now supports Mac Catalyst.
Thanks to @msrutek-paylocity the unit tests are in a much better shape.
This version adjusts some display issues when changing text style.
This version reverts the .presentationBackgroundInteraction
addition that caused the format sheet to appear behind the keyboard.
This version drops support for iOS 14, tvOS 14, macOS 11 and watchOS 7.
This version also consolidates all separate attribute readers and writers into the base attribute reader/writer protocols.
RichTextColor
is a new enum that defines supported colors that can be set.RichTextColorPicker
now works on all platforms.RichTextCommandButton
is a new button for commands.RichTextCommandButtonGroup
is a new button group for commands.RichTextContext
has new enum-based style and color functions.RichTextAttributeReader
can handle more colors and superscripting.RichTextAttributeWriter
can handle more colors and superscripting.
RichTextAttributeReader
now has all specific getter functions.RichTextAttributeWriter
now has all specific setter functions.RichTextKeyboardToolbar
now opens the format sheet in medium size on iPhone.
-
All specific attribute reader/writer protocols are deprecated in favor of the base protocols.
-
Many getter/setter functions have been prefixed with
richText
. -
RichTextAttributeWriter
renames functionality and omitsto:
param name. -
RichTextColorPicker
initializer has been cleaned up and simplified. -
RichTextColorPicker.PickerColor
has been deprecated. -
RichTextColorPickerColor
has been deprecated. -
RichTextContext
replaces a lot of action-based functions withhandle(_:)
. -
RichTextIndent
has been deprecated. -
RichTextIndentPicker
has been deprecated. -
RichTextViewComponent
and omitsto:
param name.
- The rich text indent feature has been rewritten to use steps.
- Some
richTextMenu*
images are renamed torichTextAction*
. RichTextContext
replaces a lot of action-based functions withhandle(_:)
.
This version makes the observable trigger properties internal.
These properties were never made to be used from the outside. Instead, use the functions that trigger them.
IMPORTANT
The safeRange
adjustment may lead to crashes, although I haven't been able to make it crash. If so, investigate. Perhaps we should use attributedString.string.count
instead?
RichTextContext
has a newattributedString
property.RichTextContext
's paste functions now use the selected range index as default index.
RichTextReader
safeRange
no longer subtracts 1 from the string length.RichTextReader
will now move the cursor after the pasted text, if it's pasted at selected range.RichTextViewComponent
image pasting has been rewritten.RichTextViewComponent
will now clear the selected range when pasting in images using that range.
RichTextReader
safe range fix makes pasting text at the end behave better.RichTextViewComponent
now properly restores the font size after pasting an image.
RichTextContext
trigger properties have been made internal.
This version makes the keyboard toolbar menu prefer fixed menu order.
This version tweaks the new color picker component a little.
RichTextColorPicker
now supports hiding the icon.RichTextColorPicker
now supports specifying quick colors.RichTextColorPickerColor
is a new enum with curated colors.
RichTextFormatSheet
adds curated colors to its color pickers.RichTextFormatSidebar
adds curated colors to its color pickers.
RichTextColorPickerStack
has been deprecated.
This update reverts a RichTextEditor
view update that made the editor less performant.
-
Thanks to @jamesbradleym, RichTextKit now supports text indentation.
-
Image
has newrichTextIndentDecrease
andrichTextIndentIncrease
actions. -
NSTextAttachment
has a newattachedImage
property. -
RichTextAction
has newincreaseIndent
anddecreaseIndent
actions. -
RichTextActionButtonGroup
is a new view that groups multiple action buttons together. -
RichTextAttributeWriter
now supports affecting the entire text by default. -
RichTextButtonGroup
is a new view that groups multiple buttons together. -
RichTextColorWriter
now supports affecting the entire text by default. -
RichTextContext
has newcanDecreaseIndent
andcanIncreaseIndent
properties. -
RichTextContext
has newdecreaseIndent()
andincreaseIndent()
functions. -
RichTextContext
has newresetAttributedString()
andsetAttributedString()
functions. -
RichTextFontWriter
now supports affecting the entire text by default. -
RichTextFormatSheet
now groups related buttons and also adds indent buttons. -
RichTextIndent
is a new enum for handling text indent changes. -
RichTextIndentPicker
is a new enum for picking a text indent. -
RichTextIndentReader
is a new type for managing text indents. -
RichTextIndentWriter
is a new type for managing text indents. -
RichTextKeyboardToolbar
now supports modifying the format sheet before presenting it. -
RichTextStyleToggleGroup
is a new view that groups multiple toggles together. -
RichTextStyleWriter
now supports affecting the entire text by default.
- Thanks to @willmorris44 and @diniska, the UIKit and AppKit
RichTextView
s now update whenever the text changes. - Thanks to @msrutek-paylocity, some typos are fixed and some tests cleaned up.
- This version fixes a bug where setting up an editor with a text that had image attachments, didn't resize the images until the user typed in the text editor.
RichTextKeyboardToolbar
height
andspacing
has been moved toRichTextKeyboardToolbarStyle
.
- Initial text color is only applied when setting up rich text with an empty string.
- All deprecated types have been removed.
This release addresses some performance changes, by trying to minimize the number of redraws.
As a result, the RichTextContext
's selectedRange
is no longer observable, since that caused every input or text position change to redraw the entire app. The library and demo app however still updates way to often, and too much. For instance, switching between having a selected range and not should only redraw the copy button, but now updates the entire screen. If you know how to minimize this, please reach out.
Furthermore, this release adds support for focus values and menu commands. You can see them in action in the demo app.
Commands
is a new namespace for app commands.Focus
is a new namespace for focus values.RichTextDataFormat
has a newfileFormatText
property.RichTextDataFormat
has a newisArchivedDataFormat
property.RichTextDataFormat
has a newlibraryFormats
property that returns all formats except thevendorArchivedData
format.RichTextDataFormatMenu
is a new menu that triggers an action for various formats.RichTextDataReader
now has ways to get data for the current rich text.RichTextExportMenu
is a new menu for exporting rich text.RichTextContextFocusedValueKey
is a new rich text context focus key.RichTextFormatCommandMenu
is a new command menu for adding rich text formatting to the system menu.RichTextNSSharingMenu
is a new macOS-specific menu for sharing rich text withNSSharingServices
.RichTextShareCommandMenu
is a new command menu for adding rich text sharing and exporting to the system menu.RichTextShareMenu
is a new menu for sharing rich text.ViewDebug
is a new demo app class that is used for view debugging capabilities.- The library is now localized in Danish, German and Norwegian, although some translations probably need adjusting.
RichTextCoordinator
now checks if properties have changed before it syncs.
RichTextKeyboardToolbar
no longer allocates width for hidden items.RichTextStyleToggle
is no longer tinted by default when inactive.
PdfDataReader
has been renamed toRichTextPdfDataReader
.RichTextDataWriter
is deprecated.RichTextDataWriter
functionality has been moved toRichTextDataReader
.
RichTextContext
no longer has a font size in the initializer, useStandardFontSizeProvider
(CGFloat, TextEditor etc.) instead.RichTextContext
selectedRange
is no longer published.RichTextDataReader
now implementsRichTextReader
.RichTextDataReader
format-specific data functions have been made private.RichTextStyleToggle.Style
inactiveColor
is now optional.NSMutableString
format-specific initializers have been made private.
This release adds support for strikethrough and cleans up some 0.2 code. It also adds a bunch of new views, such as toolbars, sidebars, sheets etc., as well as support for keyboard shortcuts, localization and accessibility.
Bundle.richTextKit
is a new bundle extension that works in external previews.RichTextAction
has a newdismissKeyboard
action.RichTextAction
has newincrementFontSize
anddecrementFontSize
actions.RichTextAction
has newundo
andredo
name aliases.RichTextActionButton
has a newfillVertically
parameter.RichTextFormatSheet
is a new view that collects a bunch of text formatting controls.RichTextFormatSidebar
is a new view that collects a bunch of text formatting controls.RichTextKeyboardToolbar
is a new toolbar that can be used on iOS.RichTextKeyboardToolbarMenu
is a new toolbar menu.RichTextStyle
has a newstrikethrough
style.RichTextStyleToggle
has a newfillVertically
parameter.RTKL10n
is a new enum with localized strings, which is used to localize multiple types.View+KeyboardShortcuts
is a new view extension to simplify binding keyboard shortcuts to views.- The various stack views now support
RichTextActionButtonStack
andRichTextStyleToggleStack
now fills vertically.RichTextStyleButton
andRichTextStyleToggle
now applies keyboard shortcuts.RichTextStyleToggle
applies a toggle-like style to fallbacks on older OS versions.- Many pickers, buttons and toggles apply a localized accessibility label.
- More buttons apply a rectangular content shape.
RichTextActionButtonStack
no longer has default actions.RichTextActionButtonStack
no longer has a bordered init parameter.RichTextAlignmentPicker
no longer has title and segmented parameters.RichTextFontSizePickerStack
no longer has a bordered init parameter.RichTextFontSizePickerStack
now requires aRichTextContext
instead of a binding.
Image
has new rich text-specific images.NSImage
cgImage
andjpegData
are now public.NSAttributedString
has a newwithBlackText()
extension.NSAttributedString
has a new init extension file.RichTextAction
is a new enum that defines rich text actions.RichTextActionButton
is a new view that can trigger a RichTextAction.RichTextActionButtonStack
is a new view that can list multiple RichTextActionButton views.RichTextContext
has new bindings.RichTextCoordinator
now subscribes to highlighting style changes.RichTextCoordinator
cancellables
are now public.RichTextCoordinator
resetHighlightedRangeAppearance()
is now public.RichTextCoordinator
text
is now mutable.RichTextColorPicker
is a new color picker.RichTextColorPickerStack
is a new view that can list multiple RichTextColorPicker views.RichTextDataFormat
has a new vendor-specific data format.RichTextFontSizePickerStack
is a new view that can list multiple RichTextFontSizePicker views.RichTextImageAttachment
is now open for inheritance.RichTextStyleButton
has a new button style.RichTextStyleToggle
is a new style toggle button.RichTextStyleToggleStack
is a new view that can list multiple RichTextStyleToggle views.RichTextView
is now open for inheritance.RichTextView
drop interaction functionality is now open.String
extensions have been made public.
RichTextAlignmentPicker
is now segmented by default.
Font
picker components have been renamed with aRichText
prefix.FontSizePicker
sizes
has been renamed tovalues
.PdfDataWriter
has been renamed toPdfDataReader
.RichTextAlignmentPicker
alignments
has been renamed tovalues
.RichTextContext
alignment
has been renamed totextAlignment
.RichTextContext
standardHighlightingStyle
has been renamed tohighlightingStyle
.RichTextCoordinator
context
has been renamed torichTextContext
.RichTextDataWriter
richTextData(with:)
has been renamed torichTextData(for:)
.RichTextViewRepresentable
has been renamed toRichTextViewComponent
.
RichTextView
alert functiontitle
parameter is no longer implicit.RichTextViewRepresentable
decrementFontSize
has been renamed todecrementCurrentFontSize
and has no range parameter.RichTextViewRepresentable
incrementFontSize
has been renamed toincrementCurrentFontSize
and has no range parameter.
This is a small bugfix release.
RichTextCoordinator
now subscribes to image pasting.
This is a small bugfix release.
RichTextAlignmentWriter
now uses safe ranges to avoid occasional crashes.
This is the first beta release of RichTextKit.
The release includes the following.
RichTextView
is a replacement forUITextView
andNSTextView
.RichTextEditor
is a SwiftUI view that embeds aRichTextView
.RichTextContext
is used to inspect and interact with aRichTextEditor
.RichTextCoordinator
is used by aRichTextEditor
to keep the text view and context in sync.
RichTextKit adds extensive support for a bunch of rich text features:
- Alignment
- Attributes
- Colors
- Data
- Export
- Fonts
- Images
- Pasteboard extensions
- Sharing
- Styles
- Views