【发布时间】:2019-06-25 09:47:48
【问题描述】:
因此,对于 Swift,我们可以使用 & 运算符创建新类型或作为参数传递给方法。
示例 Swift 代码:
protocol Fooable {}
protocol Barable {}
// the new protocol
typealias FooBarable = Fooable & Barable
// method parameter
func doSomethingFor(object: Fooable & Barable) { ... }
有没有办法在 Kotlin 的接口中做到这一点?
【问题讨论】:
标签: swift kotlin interface protocols swift-protocols