protocol P { associatedtype SomeType func someValue() -> SomeType } struct S : P { func someValue() -> opaque SomeType { ... } } let sv: S.SomeType sv = S().someValue()