If I wanted to expose a Kotlin interface in Swift ...
# kotlin-native
k
If I wanted to expose a Kotlin interface in Swift as
AnyObject
, what would that be in Kotlin?
Any
in Kotlin is just
Any
in swift. Would it be
Any?
j
AnyObject
in Swift is the same as the
id
type in Objective-C. I believe an
abstract class
in Kotlin should satisfy
AnyObject
, as Kotlin classes will inherit from the
NSObject
base class.
k
Yeah so turned out that just using a random class other than
Any
worked, which was a bit weird.
j
Yeah,
Any
in Swift basically expands on
AnyObject
from Objective-C. Any class from Objective-C or Swift should satisfy
AnyObject
. But besides classes, structs, enums, and function types in Swift satisfy
Any
, a superset of
AnyObject
.