Skip to content

iOS: classification runs on the platform thread #39

Open

Description

@developerjamiu
// ios/smart_text_flutter/Sources/smart_text_flutter/SmartTextFlutterPlugin.swift:18
let smartTexts = textClassifier.classifyText(text: args)

handle runs on the platform thread, so NSDataDetector scanning happens inline and long text janks the UI.

Android already does this correctly, dispatching to Dispatchers.Default at SmartTextFlutterPlugin.kt:37.

Two smaller wins in the same area:

  • NSDataDetector is constructed per call (TextClassifier.swift:18). It is reusable; hold it as a lazy static.
  • A fresh DateFormatter is allocated per matched date (NSDataDetectorExtension.swift:88).

Fix: dispatch classification to a background queue and deliver result on the main queue.

Found during the v0.4.0 codebase audit.

Activity

  1. added
    enhancement
    platform: ios
    performance
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementperformanceplatform: ios

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions