Is there a way in Kotlin multiplatform to mimic Swift's
override class func
in Kotlin (in iOSMain)?
j
Jeff Lockhart
06/30/2023, 12:32 AM
No. Kotlin companion object functions are the closest equivalent to a Swift class function. But companion object functions behave like Java statics. You can't override them.
s
streetsofboston
06/30/2023, 12:35 AM
Yeah... I was hoping there'd be some special annotations in KMP, for Kotlin in iosMain, that would allow to 'override' these "class funcs" for the backing meta-class.
streetsofboston
06/30/2023, 12:37 AM
Example, being able to override the class func canInitialize(request:) in a Kotlin subclass of of a NSURLProtocol.