Hello. Tell me, is it possible to somehow make protocol Identifiable in the data class for swift?
h
hfhbd
10/25/2022, 4:37 PM
Yes and no, there is no Swift interop so you can’t implement this interface in Kotlin, but you simple can define this interface in Kotlin and use the Kotlin interface in Swift with a Swift extension.
t
tylerwilson
10/25/2022, 5:53 PM
Copy code
extension RocketModel: Identifiable {
public var id: Int {
self.flightNumber
}
}
maybe?
s
Sebastien Leclerc Lavallee
10/25/2022, 7:18 PM
Pretty much yes. It should do the trick
x
xxfast
10/26/2022, 5:25 AM
Really like how in swift you can extend and add interfaces - wish we can do the same in Kotlin