Sunday, December 15, 2024
HomeiOS Developmentios - get forged error for Generic sort in xcode 16 for...

ios – get forged error for Generic sort in xcode 16 for swift 6


I bought a construct error for beneath code after utilizing xcode 16

Solid from 'ObservableCollection.SectionsChange' (aka 'CollectionChange>') to unrelated sort 'ObservableCollection.SectionsChange' (aka 'CollectionChange>') all the time fails

for the part protocol technique I applied, first forged remains to be working

class ObservableCollectionDelegateMock: ObservableCollectionDelegate {

    var collectionDidRowBatchUpdateAtExpect = LIExpect()
    var collectionDidSectionBatchUpdateAtExpect = LIExpect()
    var rowBatchUpdates: ObservableCollection.RowsChange?
    var sectionBatchUpdates: ObservableCollection.SectionsChange?

    func assortment(_ assortment: ObservableCollection, rowsDidChange change: ObservableCollection.RowsChange) {
        collectionDidRowBatchUpdateAtExpect.referred to as(actualParams: nil)
        rowBatchUpdates = change as? ObservableCollection.RowsChange
    }

    func assortment(_ assortment: ObservableCollection, sectionsDidChange change: ObservableCollection.SectionsChange) {
        collectionDidSectionBatchUpdateAtExpect.referred to as(actualParams: nil)
        sectionBatchUpdates = change as? ObservableCollection.SectionsChange
    }
}

right here is the definition of the these 2 alias.


 class ObservableCollection {

    // MARK: - Nested Varieties

    public typealias RowsChange = CollectionChange
    public typealias SectionsChange = CollectionChange>

     .......
 }

and that is the outline of ObservableArray

public class ObservableArray {

    // MARK: - Public Properties

    public var rely: Int {
        return components.rely
    }

    public var isEmpty: Bool {
        return components.isEmpty
    }
    public var hasElements: Bool {
        return !components.isEmpty
    }

    /// Returns the snapshot of present state as a traditional array. (Basically returning the copy of itself).
    public var snapshot: [T] {
        return components
    }

    // MARK: - Inner Properties

    inner(set) public var components: [T]

    // MARK: - Lifecycle

    public init(components: S) the place S: Sequence, S.Aspect == T {
        self.components = [T](components)
    }
    
    ......

From what I’m understanding, appears for xcode 16, then cannot case the generic sort by compiler if there are nested generic sorts.

which is our case is

ObservableCollection.SectionsChange’ (aka ‘CollectionChange‘)

marvel if there may be anyway to go round this? or that is what swift 6 forbid to do?

thanks

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments