Denis Shurygin
07/05/2018, 12:30 PMDenis Shurygin
07/05/2018, 2:34 PMDenis Shurygin
07/05/2018, 2:41 PM[player moveTo:LEFT byMeters:17]
[player moveTo:UP byInches:42]
In Objective-c overriding can look as following:
-(void) moveTo:(int)direction byMeters:(double) distance {
...
}
But how do I override them in Kotlin Native?AnaR
07/05/2018, 3:31 PMsvyatoslav.scherbina
07/06/2018, 8:18 AMBut, my guess it it would be how you’d do regular kotlin inheritance.Exactly.
Denis Shurygin
07/06/2018, 9:07 AMoverride fun moveTo(direction:Int, byMeters:double)
override fun moveTo(direction:Int, byInches:double)
They are equal from Kotlin piont of view. But not for Objective-C in case if you hawe two following methods:
-(void) moveTo:(int)direction byMeters:(double) distance
-(void) moveTo:(int)direction byInches:(double) distance
svyatoslav.scherbina
07/06/2018, 9:19 AMThey are equal from Kotlin piont of view.They are not considered equal in this special case when overriding Objective-C methods. Have you tried to write such a code?
Denis Shurygin
07/06/2018, 11:48 AMfunc show(_ vc: UIViewController, sender: Any?)
Here is my implementation:
override fun show(vc: UIViewController, sender: Any?) {
super.show(vc, sender = sender)
}
But I faced with 2 errors:
1 string: 'show' overrides nothing
2 string: Unresolved reference: show
I use konan plugin version 0.7.1svyatoslav.scherbina
07/06/2018, 1:20 PMopen external fun showViewController(vc: UIViewController, sender: Any?)
and thus should be called and overridden using this signature.Denis Shurygin
07/06/2018, 3:16 PMDenis Shurygin
07/06/2018, 3:23 PMsvyatoslav.scherbina
07/23/2018, 1:56 PMklib
command-line util:
$ ./bin/klib contents ./klib/platform/ios_arm64/UIKit > log