Post

Replies

Boosts

Views

Activity

Comment on Swift Protocol Constraint Required - Advanced
thanks but it does not work, the code compiles ok but if you try to instantiate the FiltersManager class you will have an error you can't pass an array of type Any SimpleFilter to filters typed as [U] in the class initializer Compiler error: Type 'any SimpleFilter' cannot conform to 'SimpleFilter' try this you will see let filters: [any SimpleFilter] = [CountryFilter(), RegionFilter()] var cities = [City]() let manager = TestFiltersManager(array: cities, filters: filters)
Oct ’22