【发布时间】:2016-09-13 11:33:40
【问题描述】:
我使用此代码来调整集合视图的模型。问题是当我修改 model 变量时,它也修改了 originalModel 变量,因为它是静态的,这不是我的意图。我想保持 originalModel 变量静态,但只是将其内容复制到 model 变量
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
}
}
}
【问题讨论】:
标签: ios swift static uicollectionview