louiscad
06/23/2019, 8:26 PMNSObject observability, but I'm struggling to understand how this Objective-C method signature translates to Kotlin: https://developer.apple.com/documentation/objectivec/nsobject/1416553-observevalueforkeypath?language=objc
It seems I need to declare it in an NSObject subclass for addObserver to work: https://developer.apple.com/documentation/objectivec/nsobject/1412787-addobserver?language=objc
Can anyone help me?basher
06/23/2019, 8:30 PMlouiscad
06/23/2019, 8:44 PMid type translate to in Kotlin? I see it's used twice, in the type of ofObject, and in the type parameter of change.basher
06/23/2019, 8:45 PMbasher
06/23/2019, 8:46 PMlouiscad
06/23/2019, 8:47 PMsuspend and Flow library instead πlouiscad
06/23/2019, 8:48 PMNSUserDefaults to fire a listener that is used to emit to a Flowbasher
06/23/2019, 8:53 PMlouiscad
06/23/2019, 8:56 PMfun observeValueForKeyPath(
keyPath: String,
ofObject: Any?,
change: NSDictionary?,
context: CPointerVar<*>?
) {
TODO("Should crash :D")
}
not sure yet if CPointerVar<*>? is the correct translation of void * which I now see Swift calls UnsafeMutableRawPointer?.basher
06/23/2019, 9:01 PMbasher
06/23/2019, 9:02 PMbasher
06/23/2019, 9:02 PMlouiscad
06/23/2019, 9:03 PMbasher
06/23/2019, 9:03 PMbasher
06/23/2019, 9:04 PMlouiscad
06/23/2019, 9:04 PMbasher
06/23/2019, 9:06 PMlouiscad
06/23/2019, 9:06 PMbasher
06/23/2019, 9:07 PMlouiscad
06/23/2019, 9:09 PMgo to sleep and work on Android stuff tomorrow before resuming Obj-C fun (wow, so many coroutines puns there)basher
06/23/2019, 9:13 PMsuspend this explorationlouiscad
08/05/2019, 2:34 PMdealloc. But the fact that it can run on any thread doesn't make the things easier with Kotlin/Native way of doing things.
resumeWithException(TooHardException("Swift solution is so complicated!"))louiscad
08/11/2019, 10:36 PM