Is there a reason why I can't override <didMoveToP...
# ios
a
Is there a reason why I can't override didMoveToParentViewController for in a Kotlin implementation of
UIViewController
? There is only
platform.UIKit.UIViewController.didMoveToParentViewController
extension function.
To override this function, you can do as we did in #data2viz for
drawRect
in `UIKit`'s `UIView`: https://github.com/data2viz/data2viz/blob/5640d3e8f1ce4cd4e5d651431726869e329520fc/viz/src/nativeinterop/cinterop/uikit.def
a
Thank you! I will try that!
r
Can't you just annotate your function with
@ObjCAction
in that case?
a
Thanks @ribesg, I will try that as well. The possible issue I believe is that we should call super, right?
r
Well Apple's documentation does not say that
a
I usually assume that we should always call super, unless documented otherwise. 😁
r
I usually don't assume that the super function needs to be called unless the documentation says so
a
Lol)
r
🙂
I never used that function, but last time I checked for 2 other functions the super implementation were empty
l
How do you check the super implementation on closed source iOS?
r
You find some guy on the internet stating it doesn't do anything, then you try it and nothing breaks when you just not call super because you don't know how to, then you just roll with it
l
Lovely workflow, that is something only Apple could do 😍
r
🍎 🥊
😆 2
But really, if the super function does something, but your testing shows no issue when you're not calling super, then it doesn't really matter if it does something or not. You're on iOS, having things work is already an achievement
🏆 1
a
But even if we could see the code, it could still be different on different versions. There may even be a minor system update which adds code to super.
r
Exactly, so why bother anyway. Apple will make updates that will fuck up everything anyway.
Just try it and if it works it works