I'm trying to declare a property with an array of any type T. But I'm getting compiler error - Use of undeclared type 'T'. Below is the class that I created with 2 properties.
class Product {
var productName: String;
var items: Array<T>
}
Please let me know how to declare an array of any type using Generics in Swift. I've tried the below options:
{
var items: Array<T>;
var items = Array<T>();
var items = [T]();
}