/proto-protocols

A Workaround for some "Protocol can only be used as a generic constraint" error situations

MIT LicenseMIT

proto-protocols

A Workaround for some "Protocol can only be used as a generic constraint" error situations

A PATs Swift 3.1 Playground (c) 2017 Jon Gilbert. MIT License. Works with minor mods in Swift 4.

So you want to get around the dreaded error: protocol 'Bar' can only be used as a generic constraint because it has Self or associated type requirements? Here's a possible way. Check out the playgroundpage. It's self-explanatory.