Код: Выделить всё
Cast from 'ObservableCollection.SectionsChange' (aka 'CollectionChange') to unrelated type 'ObservableCollection.SectionsChange' (aka 'CollectionChange') always fails
Код: Выделить всё
class ObservableCollectionDelegateMock: ObservableCollectionDelegate {
var collectionDidRowBatchUpdateAtExpect = LIExpect()
var collectionDidSectionBatchUpdateAtExpect = LIExpect()
var rowBatchUpdates: ObservableCollection.RowsChange?
var sectionBatchUpdates: ObservableCollection.SectionsChange?
func collection(_ collection: ObservableCollection, rowsDidChange change: ObservableCollection.RowsChange) {
collectionDidRowBatchUpdateAtExpect.called(actualParams: nil)
rowBatchUpdates = change as? ObservableCollection.RowsChange
}
func collection(_ collection: ObservableCollection, sectionsDidChange change: ObservableCollection.SectionsChange) {
collectionDidSectionBatchUpdateAtExpect.called(actualParams: nil)
sectionBatchUpdates = change as? ObservableCollection.SectionsChange
}
}
Код: Выделить всё
class ObservableCollection {
// MARK: - Nested Types
public typealias RowsChange = CollectionChange
public typealias SectionsChange = CollectionChange
.......
}
Код: Выделить всё
public class ObservableArray {
// MARK: - Public Properties
public var count: Int {
return elements.count
}
public var isEmpty: Bool {
return elements.isEmpty
}
public var hasElements: Bool {
return !elements.isEmpty
}
/// Returns the snapshot of current state as a normal array. (Essentially returning the copy of itself).
public var snapshot: [T] {
return elements
}
// MARK: - Internal Properties
internal(set) public var elements: [T]
// MARK: - Lifecycle
public init(elements: S) where S: Sequence, S.Element == T {
self.elements = [T](elements)
}
......
в нашем случае это
ObservableCollection.SectionsChange' (также известный как 'CollectionChange')
интересно есть ли способ обойти это? или это то, что Swift 6 запрещает делать?
спасибо
Подробнее здесь: https://stackoverflow.com/questions/790 ... or-swift-6