Backporting to iOS 17, macOS 14.#69
Open
llsc12 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR lowers the package deployment targets to iOS 17 / macOS 14 (and corresponding tvOS/watchOS/visionOS versions) by replacing iOS 18/macOS 15-only SwiftUI APIs with backported implementations and by gating newer text-interaction features behind availability checks.
Changes:
- Downgrade supported platform minimums in
Package.swift(macOS 14, iOS 17, tvOS 17, watchOS 10, visionOS 1). - Replace SwiftUI
@Entryenvironment entries with explicitEnvironmentKey+EnvironmentValuesaccessors across the codebase. - Gate iOS 18/macOS 15 text interaction/selection/attachment behaviors behind
#availablechecks and add small “backporting” utilities (SubviewGroup,CGSize: Hashableretroactive conformance).
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Textual/StructuredText/Style/UnorderedListMarker.swift | Replace @Entry with EnvironmentKey for unordered list marker configuration. |
| Sources/Textual/StructuredText/Style/ThematicBreakStyle.swift | Replace @Entry with EnvironmentKey for thematic break styling. |
| Sources/Textual/StructuredText/Style/TableStyle.swift | Replace @Entry with EnvironmentKey for table styling. |
| Sources/Textual/StructuredText/Style/TableCellStyle.swift | Replace @Entry with EnvironmentKey for table cell styling. |
| Sources/Textual/StructuredText/Style/ParagraphStyle.swift | Replace @Entry with EnvironmentKey for paragraph styling. |
| Sources/Textual/StructuredText/Style/Overflow.swift | Backport scroll-geometry + preference suppression behind iOS 18/macOS 15 checks; migrate env entry to EnvironmentKey. |
| Sources/Textual/StructuredText/Style/OrderedListMarker.swift | Replace @Entry with EnvironmentKey for ordered list markers. |
| Sources/Textual/StructuredText/Style/ListItemStyle.swift | Replace @Entry with EnvironmentKey for list item styling. |
| Sources/Textual/StructuredText/Style/HeadingStyle.swift | Replace @Entry with EnvironmentKey for heading styling. |
| Sources/Textual/StructuredText/Style/CodeBlockStyle.swift | Replace @Entry with EnvironmentKey for code block styling. |
| Sources/Textual/StructuredText/Style/BlockQuoteStyle.swift | Replace @Entry with EnvironmentKey for block quote styling. |
| Sources/Textual/StructuredText/HighlighterTheme/HighlighterTheme.swift | Replace @Entry with EnvironmentKey for highlighter theme selection. |
| Sources/Textual/MathProperties.swift | Replace @Entry with EnvironmentKey for math rendering properties. |
| Sources/Textual/Internal/TextInteraction/UIKit/UITextInteractionView+UITextInputTokenizer.swift | Gate UIKit tokenizer conformance behind iOS 18 availability. |
| Sources/Textual/Internal/TextInteraction/UIKit/UITextInteractionView+UITextInput.swift | Gate UIKit UITextInput conformance behind iOS 18 availability. |
| Sources/Textual/Internal/TextInteraction/UIKit/UITextInteractionView.swift | Gate the UIKit interaction view and delegate conformance behind iOS 18 availability. |
| Sources/Textual/Internal/TextInteraction/UIKit/UIKitTextSelectionInteraction.swift | Gate iOS selection interaction behind iOS 18 availability; adjust typealias/struct availability. |
| Sources/Textual/Internal/TextInteraction/UIKit/UIKitTextInteractionOverlay.swift | Gate UIKit overlay representable behind iOS 18 availability. |
| Sources/Textual/Internal/TextInteraction/UIKit/TextSelectionRectBox.swift | Gate selection rect boxing behind iOS 18 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextSelectionModel.swift | Gate observable selection model behind iOS 18/macOS 15 availability; adjust per-platform method availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextSelectionInteraction.swift | Introduce availability-gated selection modifier body; migrate textSelection env entry to EnvironmentKey. |
| Sources/Textual/Internal/TextInteraction/Shared/TextSelectionCoordinator.swift | Gate coordinator creation/injection behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextSelectionBackground.swift | Gate AppKit selection background rendering behind macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLinkInteraction.swift | Gate link-tap overlay behind availability checks and move tap helper availability accordingly. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/View+TextLayoutCollection.swift | Gate overlay layout collection helper behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+SelectionRects.swift | Gate selection-rect computation helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+RunSliceTraversal.swift | Gate run-slice traversal behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+Ranges.swift | Gate range helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+Positioning.swift | Gate positioning helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+Geometry.swift | Gate geometry helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection+AttributedStringAccess.swift | Gate attributed-string access helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/TextLayoutCollection.swift | Gate TextLayoutCollection protocols/types behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/LiveTextLayoutCollection.swift | Gate live layout collection implementation behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/Layout+Internals.swift | Gate Text.Layout reflection helpers behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/TextLayout/EmptyTextLayoutCollection.swift | Gate empty layout collection behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/Shared/LinkAttribute.swift | Add explicit availability for custom link TextAttribute plumbing. |
| Sources/Textual/Internal/TextInteraction/AppKit/NSTextInteractionView.swift | Gate AppKit interaction view behind macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/AppKit/AppKitTextSelectionView.swift | Gate AppKit selection highlight view behind macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/AppKit/AppKitTextSelectionInteraction.swift | Gate AppKit selection interaction modifier behind macOS 15 availability. |
| Sources/Textual/Internal/TextInteraction/AppKit/AppKitTextInteractionOverlay.swift | Gate AppKit overlay representable behind macOS 15 availability. |
| Sources/Textual/Internal/TextFragment/TextFragment.swift | Avoid Text.customAttribute on older OS by gating fragment tagging to iOS 18/macOS 15. |
| Sources/Textual/Internal/TextFragment/TextBuilder.swift | Gate attachment/link custom attributes behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/StructuredText/ListEnvironment.swift | Replace @Entry list environment fields with explicit EnvironmentKeys. |
| Sources/Textual/Internal/StructuredText/BlockVStack.swift | Replace Group(subviews:) usage with SubviewGroup backport and minor formatting adjustments. |
| Sources/Textual/Internal/Backporting/SubviewGroup.swift | Add a backported subview grouping view based on _VariadicView. |
| Sources/Textual/Internal/Backporting/CGSize+Hashable.swift | Add pre-iOS18/macOS15 retroactive CGSize: Hashable conformance. |
| Sources/Textual/Internal/Attachment/AttachmentView.swift | Gate attachment overlay view behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/Attachment/AttachmentOverlay.swift | Gate attachment overlay preference reading behind iOS 18/macOS 15 availability. |
| Sources/Textual/Internal/Attachment/AttachmentAttribute.swift | Gate attachment TextAttribute plumbing behind iOS 18/macOS 15 availability. |
| Sources/Textual/InlineText/InlineStyle.swift | Replace @Entry with EnvironmentKey for inline style. |
| Sources/Textual/EmojiProperties.swift | Replace @Entry with EnvironmentKey for emoji properties. |
| Sources/Textual/Attachment/AttachmentLoader.swift | Replace @Entry with EnvironmentKey for attachment loaders. |
| Package.swift | Lower platform minimum versions to iOS 17/macOS 14/etc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| tap( | ||
| origin: geometry[anchoredLayout.origin], | ||
| layout: anchoredLayout.layout | ||
| if #available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) { |
Comment on lines
+42
to
43
| @available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) | ||
| private func tap(origin: CGPoint, layout: Text.Layout) -> some Gesture { |
Comment on lines
+3
to
+7
| public struct SubviewGroup<Result: View>: View { | ||
| private let content: AnyView | ||
| private let transform: (_VariadicView.Children) -> Result | ||
|
|
||
| public init<Content: View>( |
| self.transform = transform | ||
| } | ||
|
|
||
| public var body: some View { |
Comment on lines
+13
to
+14
| @available(iOS 18, *) | ||
| typealias PlatformTextSelectionInteraction = UIKitTextSelectionInteraction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cuts some features for the sake of general usability in earlier versions of macOS and iOS.