Skip to content

Conversation

comhendrik
Copy link

@comhendrik comhendrik commented Jun 3, 2022

I have created the first version of this function, but the function is not ready yet. The functionality works as shown in the video below. I need a little more time to make it work automatically and to make the function compatible with images. I have commented out the corresponding code, because when a monthly transaction is made the following message comes:
CoreData: debug: PostSaveMaintenance: fileSize 12347672 greater than prune threshold CoreData: debug: PostSaveMaintenance: incremental_vacuum with freelist_count - 1491 and pages_to_free 298 CoreData: annotation: PostSaveMaintenance: wal_checkpoint(TRUNCATE)
. But I wanted to show you some of my code to get some initial feedback. I want to know if this way of linking the view models to the new core data entity is the right one or if you might have some other ideas. #29 Thank you for the opportunity to contribute.

MonthlyTransactions1.mp4

@comhendrik
Copy link
Author

I added an automatic version but I don't know if .onAppear() {} on the NavigationView in ExpenseView is the right way

Copy link
Owner

@sameersyd sameersyd left a comment

Choose a reason for hiding this comment

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

We can reuse the same model and files instead of duplicating. You just need to add a new frequency var in DataModel and update design accordingly. I'd recommend creating a new branch from main to implement this as the current one takes a different approach.

import Foundation
import CoreData

public class MonthlyTransactionCD: NSManagedObject, Identifiable {
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of new model, we can use the existing model ExpenseCD with frequency enum. Which can store values such as { onetime, monthly }. Use this frequency val to query.

Also we don't need a separate button (Add income every month) to create recurring expense. Let's add a toggle which can update the frequency value.

IMG_514CF50EB555-1

Copy link
Author

Choose a reason for hiding this comment

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

Is there a possibility that this feature will be included in the app in the App Store? I ask myself this question because you mentioned that this is a different approach. However, I will start working on it.

class AddExpenseViewModel: ObservableObject {

var expenseObj: ExpenseCD?
var monthlyTransactionObj: MonthlyTransactionCD?
Copy link
Owner

Choose a reason for hiding this comment

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

Please update this to use single model (refer above comment).

@comhendrik comhendrik closed this Jun 19, 2022
@comhendrik comhendrik reopened this Jun 19, 2022
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.

2 participants