Skip to content

Conversation

@mc-public
Copy link

The UIColor(named:in:compatibleWith:) initializer method loads colors from the module's resource file on a global queue. Classes like LineController in the Runestone project create multiple instances of DefaultTheme during initialization, causing a large number of UIColor construction tasks to be allocated on the global queue. This can lead to noticeable lag, especially for larger texts, and prevent the editor from properly releasing memory when exiting.

The changes made in this pull request are as follows:

extension DefaultTheme {
    public static let share = DefaultTheme()
}

Then replace most occurrences of DefaultTheme() in the framework with DefaultTheme.share.

Fixed the issue where the default theme was always recreated.
@mc-public mc-public requested a review from simonbs as a code owner August 19, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant