Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix library scroll issue - part 1 #1117

Merged
merged 7 commits into from
Feb 18, 2025

Conversation

BPerlakiH
Copy link
Collaborator

@BPerlakiH BPerlakiH commented Feb 16, 2025

Mostly fixing the issue: #1116

There were 2 main issues:

  • the earlier search fix, wasn't optimal in terms of scroll performance.
  • it turned out that SwiftUI gets lost, when we use ViewModifier within a ForEach loop. It was hard to track down, but the possible explanation for this, is that SwiftUI needs to see the view hierarchy tree in order to make performant diffs between states. Now it seems that the former ViewModifier was erasing too heavily the type of the underlying views, and the performance got worse. Solution is to use view composition instead of view modifier.

The good news is that it performs a lot better now.

There needs to be a part 2 fix for this as well. There's a "micro hang" on a freshly installed app, when scrolling the new section. This is mainly due to the icon loading and saving to the DB at the same time, for which I do have some solutions, but they are not final yet, so will leave them to a new PR.

Managed to add back the animations as well, and it works great:

news_with_animation.mov

}

@ViewBuilder
var articleActions: some View {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this became: ArticleActions

}

@ViewBuilder
var supplementaryActions: some View {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this became: CopyPasteMenu

@BPerlakiH BPerlakiH changed the title Fix library scroll issue part 1 Fix library scroll issue - part 1 Feb 16, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 125 lines in your changes missing coverage. Please review.

Project coverage is 34.81%. Comparing base (594c2d5) to head (97412d7).

Files with missing lines Patch % Lines
Views/Library/ZimFilesNew.swift 0.00% 74 Missing ⚠️
Views/Library/ZimFilesCategories.swift 0.00% 12 Missing ⚠️
Views/BuildingBlocks/ArticleActions.swift 0.00% 11 Missing ⚠️
Views/BuildingBlocks/CopyPasteMenu.swift 0.00% 10 Missing ⚠️
Views/Library/Library.swift 0.00% 9 Missing ⚠️
Views/Library/ZimFilesDownloads.swift 0.00% 5 Missing ⚠️
Views/Library/ZimFilesOpened.swift 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1117      +/-   ##
==========================================
- Coverage   35.07%   34.81%   -0.27%     
==========================================
  Files         135      137       +2     
  Lines        7808     7868      +60     
==========================================
  Hits         2739     2739              
- Misses       5069     5129      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kelson42 kelson42 merged commit c5c76cb into main Feb 18, 2025
8 checks passed
@kelson42 kelson42 deleted the 1116-ios-library-scroll-no-viewmodifier-fix branch February 18, 2025 22:52
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.

3 participants