-
Notifications
You must be signed in to change notification settings - Fork 12
refactor: simplify home view #292
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
refactor: simplify home view #292
Conversation
Concept ACK I mean this is totally good as-is, the only thing im noodling on is the datasource part in I think you're datasource struct makes sense, it encapsulates those 5 properties, but also at the call-site it still requires being explicit about those 5 properties. I'm not sure how well adding a corresponding view model for Let me keep thinking on this, and if you have an additional comments/thoughts/ideas let me know. But if I haven't thought of any better way to do things in the next day or two I'll merge this because its definitely a nice refactor! |
Hi @reez, this evening I will study a better way to handle those five attributes to try to decouple these components. |
Sounds good. Dont spend too much time on it, this PR is mergeable as is, but if something better happens to come to us in the next day or so we can chat about it here and see what we think. |
…vityHomeHeardeView.State with less params
In this last commit, I moved the role logic to WalletViewModel, and in ActivityHomeHeaderView, I created an enum to represent the view state. |
After looking at the State enum approach, I think we can achieve a cleaner separation by sticking closer to direct property injection, which keeps the view simpler and avoids mixing presentation logic into the WalletViewModel. Here's why the direct property approach (with a small tweak to WalletViewModel) feels better to me:
I'll add code suggestions right now too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can add this to WalletViewModel too to make the call-site for ActivityHomeHeaderView cleaner w my proposed changes:
// Add computed property for needsFullScan
var needsFullScan: Bool {
bdkClient.needsFullScan()
}
```
Co-authored-by: Matthew Ramsden <6657488+reez@users.noreply.github.com>
Co-authored-by: Matthew Ramsden <6657488+reez@users.noreply.github.com>
…github.com/rubensmachion/BDKSwiftExampleWallet into refactor/extract-activity-header-component * 'refactor/extract-activity-header-component' of https://github.com/rubensmachion/BDKSwiftExampleWallet: Update BDKSwiftExampleWallet/View/WalletView.swift Update BDKSwiftExampleWallet/View/Home/ActivityHomeHeaderView.swift
Good calls, @reez. I just applied all your suggestions. To keep the var body: some View shorter, I created a new function to encapsulate the indicator image construction. see in |
perfect! thanks for working on+thru this! |
Description
This PR simplify HomeView by separating the Activity Header on side component
Checklists
All Submissions:
.swift-format
fileNew Features:
Bugfixes: