问题描述
同时更改空项目的身份(标识符 == nil)
extension Item: IdentifiableType {
public var identity: Int64 {
identifier ?? Self.emptyId
}
public static var emptyId: Int64 = .random(in: 0..<Int64.max)
public static func refreshEmptyItemId() {
Self.emptyId = .random(in: 0..<Int64.max)
}
}
所以表视图不会刷新此项。为什么?
但是如果我这样做
extension Item: IdentifiableType {
public var identity: Int64 {
identifier ?? .random(in: 0..<Int64.max)
}
}
然后它会刷新,但太频繁了,所以我更喜欢只在点击按钮时更改 ID。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)