Repository navigation
feat(shared-core): Swift facade for the text-format parser - #1747
Merged
Merged
Conversation
`:libs:text-format` is exported in the XCFramework, but iOS has no Swift entry point to it. `TextFormat.parse(_:ranges:)` wraps `parseTextFormat` and maps the Kotlin types to Swift: `NSRange` offsets, a `Span` enum per style, and `DisplayRange.target` as a `URL`. Offsets are UTF-16 on both sides, so they pass through unchanged. FlipcashCore already re-exports SharedCoreKit with `@_exported import`, so the new types reach it with no change on the iOS side.
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.
:libs:text-formatis in the XCFramework sinceshared-core/0.13.0, butSharedCoreKithas no Swift entry point to it, so iOS can't call the parser yet. This addsTextFormat.swiftbeside the other facades.The Kotlin types map to Swift ones, nested under
TextFormatso they don't collide with the Kotlin namesSharedCoreexports:ProtectedRangetakes anNSRangeand aRangeKind(.link,.mention).FormattedTextreturnsdisplay,spans: [Span]anddisplayRanges: [DisplayRange].Spanis an enum with one case perFormatStyle, each carrying itsNSRange.DisplayRangecarries anNSRange, its kind, andtarget: URL?for a masked link.Offsets are UTF-16 code units on both sides, so they cross unchanged. Kotlin enums arrive as classes, so the mapping switches need a
default; it traps, andTextFormatTests.mapsEveryKotlinCasewalksentriesso a style added in Kotlin fails the suite rather than a chat render.FlipcashCoreneeds no change:SharedCoreExports.swiftalready does@_exported import SharedCoreKit.iOS gets this only after a shared-core release. The iOS feature brief bumps the
flipcash-shared-core-spmpin, currently.upToNextMinor(from: "0.10.0"), and adds theFlipcashCoreVectorsfacade test the spec asks for.