//
//  ___FILENAME___
//  ___PROJECTNAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//  Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//
//  This file was generated by the Swift MVP+VM Swift Xcode Templates
//

import CoreData

class ___VARIABLE_sceneName___DataStore {
    
    func saveMyProfile(user: DataMappable) {
        CoreDataHelper.shared.performMainThreadSyncTask { (context) in
            var profile: RFUser
            if let fetchRes = RFUser.fetchObjects(context: context), let profileObj = fetchRes.first {
                profile = profileObj
            } else {
                profile = RFUser(context: context)
            }
            user.mapPropertiesTo(profile)
            do {
                try context.save()
            } catch (let err){
                print("error = \(err)")
            }
        }
    }
    deinit {
        printDebug("\(String(describing: self)) is being deInitialized.\n")
    }
}

