扩展协议以满足多个约束之一

时间:2016-04-08 06:30:08

标签: swift

我想扩展协议以满足多个约束之一。我知道如何用(,)满足多个约束,但这符合所有约束。

示例:

protocol Abc { ... }
protocol xyz { ... }
protocol my  { ... }

extenstion  Abc where Self: xyz, Self: my {
...

}

我希望Abc符合xyzmy

1 个答案:

答案 0 :(得分:1)

我认为您可以使用通用协议来执行此操作:

# Internal routing configuration to handle ESI
#_internal:
#    resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
#    prefix:   /_internal
fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /profile

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /resetting

fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /profile

fos_user_group:
    resource: "@FOSUserBundle/Resources/config/routing/group.xml"
    prefix: /group

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc