Bridge text blocks and tables to the native UIKit classes on iOS 27#1320
Merged
Conversation
UIKit publishes NSTextBlock/NSTextTable/NSTextTableBlock with the iOS 27 SDK (Xcode 27, Swift 6.4), so TextBlockConverter now compiles there too: the same identity-preserving conversion as on macOS, plus attributed-string level methods that move the DTTextBlocks attribute onto native NSParagraphStyle.textBlocks (and back), so DTCoreText output can be handed straight to TextKit. Verified on the iOS 27 simulator: TextKit 1 lays out and renders the converted tables natively, and the system HTML reader and writer round-trip them. The 27 SDKs also change the AppKit text block enums from NSUInteger to NSInteger raw types; the converter and the AppKit parity tests now bridge raw values with numericCast so they compile with both Xcode 26 and 27. Also routes tvOS through the UIKit branch for CSS shadow offsets, fixing the tvOS build. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 507eac45f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The macos-latest image only ships simulator runtimes for its default Xcode; after pinning Xcode 26.0 the test job found no iOS devices at all. Download the platform when no iPhone simulator is available before testing. Also clarify in the UIKit parity suite why the raw-value test needs no availability guard (the text block enums are available since iOS 6 in the 27 SDK; only the converter and per-edge accessors are 27-only). Co-Authored-By: Claude Fable 5 <[email protected]>
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.
What
Completes the last open item of #1317:
TextBlockConverternow bridges the DT text block model to the nativeNSTextBlock/NSTextTable/NSTextTableBlockclasses that UIKit publishes with the iOS 27 SDK — and the handoff is verified end to end on the iOS 27 simulator.compiler(>=6.4)(Xcode 27), gated@available(iOS 27.0, …)at runtime. Per-edge accessor shims paper over the API difference (NSRectEdgeon AppKit, the newCGRectEdge-basedrectEdge:methods on UIKit).addingNativeTextBlocks(to:)/addingTextBlocksAttribute(to:)convert whole strings between theDTTextBlocksattribute and nativeNSParagraphStyle.textBlockswith one converter per document, so sharedNSTextTableidentity is preserved across paragraphs. DTCoreText output can be handed straight to a TextKit view on iOS 27.NSUIntegertoNSIntegerraw types and soft-deprecate theNSRectEdgeaccessors; the converter and the AppKit parity tests now bridge raw values withnumericCastso both Xcode 26 and 27 build (the old code did not compile with Xcode 27 at all).TextBlockUIKitParityTestsmirror the AppKit parity suite against UIKit and verify the handoff empirically. (Swift Testing rejects@availableon@Test/@Suite, so the tests guard with runtime#availableinstead.)NSString+CSS.swiftusedNSValue(size:), which doesn't exist on tvOS. The branch condition is nowcanImport(UIKit); CI doesn't build tvOS, so this had gone unnoticed.Verified on the iOS 27 simulator
<th>styling / cell backgrounds rendered correctly.<table>markup from the converted blocks (Cocoa HTML Writer withtable.t1/td.td1CSS), and the system HTML reader now producesNSTextTableBlocks on iOS with the same string shape as macOS.Test matrix
swift test, as CI)CI stays green: with Xcode 26 the new code is entirely compiled out.
Closes the remaining checkboxes of #1317.
🤖 Generated with Claude Code