Skip to content

Rewrite WMFComponentsObjC in swift#5701

Open
lmazulova wants to merge 1 commit intowikimedia:mainfrom
lmazulova:components-swiftization
Open

Rewrite WMFComponentsObjC in swift#5701
lmazulova wants to merge 1 commit intowikimedia:mainfrom
lmazulova:components-swiftization

Conversation

@lmazulova
Copy link

Phabricator: N/A

Notes

  • Migrated WMFComponentsObjC source editor formatters from Objective-C to Swift

Test Steps

  1. Open source editor in the app
  2. Test bold/italic/underline formatting with toolbar buttons
  3. Test template, link, reference highlighting
  4. Verify find & replace functionality
  5. Check that selection state correctly reflects formatting at cursor position

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the WMFComponentsObjC source editor formatters from Objective-C to Swift, completing the modernization of this codebase component. The migration removes the legacy Objective-C bridge module entirely and replaces it with native Swift implementations.

Changes:

  • Migrated all source editor formatter classes from Objective-C to Swift, including text storage, formatters for bold/italics, templates, links, headings, lists, references, comments, find & replace, and various text decorations
  • Converted WMFSourceEditorColors and WMFSourceEditorFonts from Objective-C classes with mutable properties to Swift structs with immutable properties using designated initializers
  • Updated selectedMatchIndex in the find & replace formatter from NSInteger (using NSNotFound sentinel) to optional Int? (using nil), following Swift conventions
  • Updated all test files to use the new Swift API conventions and struct initialization syntax
  • Removed the WMFComponentsObjC target from Package.swift and eliminated the dependency on it

Reviewed changes

Copilot reviewed 90 out of 90 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Package.swift Removed WMFComponentsObjC target and dependency
WMFSourceEditorFormatterTests.swift Updated to use Swift API: struct initializers for colors/fonts, new method naming
WMFSourceEditorTextFrameworkMediatorTests.swift Changed assertions from NSNotFound to nil for optional selectedMatchIndex
WMFComponentsObjC/** (all .h/.m files) Deleted all Objective-C source files - migrated to Swift
WMFComponentsObjC/README.md Removed (no longer needed for Objective-C bridging)
WMFComponentsObjC/include/** Deleted all symlinked headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants