I use this code to adapt the model of a collection view. The problem is that when I modify the model variable, it also modify the originalModel variable because it's static which is not my intention. I want to keep the originalModel variable static but just copy it's content in the model variable
class Helper{
static var originalModel: [MyModel]? = nil
static func modifyDataSourceBigView () -> [MyModel]? {
if let model = originalModel {
//model.removeAtIndexPath
// Some other staff to adapt the model
return model
}
}
static func modifyDataSourceSmallView () -> [MyModel]? {
if let model = originalModel {
//model.removeAtIndexPath
// Some other staff to adapt the model
return model
}
}
}