Reputation: 4962
I am migrating a large codebase to Swift 3.0. I am generating an error "Cannot convert value of type 'Array<MultivalueEntry<Date>>?' to type 'AnyObject' in coercion.
I've even tried setting newValue to 'Array<MultivalueEntry<Date>>?'
below, and it is still generating an error:
And lastly tried setting newValue to 'Array<MultivalueEntry<NSObject>>?'
with no success:
What am I doing wrong?
UPDATE MultiValueEntry:
public struct MultivalueEntry<T> {
public var value : T
public var label : String?
public let id : Int
public init(value: T, label: String?, id: Int) {
self.value = value
self.label = label
self.id = id
}
}
Upvotes: 1
Views: 705
Reputation: 536027
The problem is that an array of generics cannot be converted to an NSArray or CFArray, because Objective-C knows nothing of generics. Well, a MultivalueEntry<Date>
is a generic.
Upvotes: 1