Usage of protocols as array types and function parameters in swift
I want to create a class that can store objects conforming to a certain protocol. The objects should be stored in a typed array. According to the Swift documentation protocols can be used as types: Because it is a type, you can use a protocol in many places where other types are allowed, including: As a parameter type or return type in a function, method, or initializer As the type of a constant, variable, or property As the type of items in an array, dictionary, or other container However the following generates compiler errors: Protocol 'SomeProtocol' can only be used as a generic constraint