I have made ContactManager protocol that have viewModel class and then extend it with some fuctions that are making changes to some properties inside viewModel but alsoe provide logical calculations/manipulations that do not require storing data.
protocol ContactManager{
var viewModel : StreamViewModel { get } }
extension ContactManager {
func deselectContacts(contacts:[ContactInfo]){
for contact in contacts {
if let index = viewModel.registeredContacts.firstIndex(where: {$0.id == contact.id}){
var cnt = viewModel.registeredContacts[index]
cnt.selected = false
viewModel.registeredContacts[index] = cnt
}
I have couple views thath are using this protocol and its functions. Is this way correct or does it effect any other development stage, like testing etc…?