Patrick Jackson
08/12/2019, 6:16 PMmyKtFun { dostuff()
return KotlinUnit() }
Thomas
08/12/2019, 6:25 PMPatrick Jackson
08/12/2019, 6:28 PMThomas
08/12/2019, 6:30 PM-Xobjc-generics
?Marc Dietrichstein
08/12/2019, 6:53 PMThomas
08/12/2019, 6:56 PMIn addition to this, the Kotlin type Unit will turn into Void in the produced frameworks.It was just below the generics supports so I thought you needed the generics for this. But it looks like it works without the generics as well.
Patrick Jackson
08/12/2019, 7:00 PMkpgalligan
08/12/2019, 8:31 PMThomas
08/12/2019, 9:26 PMkpgalligan
08/12/2019, 9:30 PMbasher
08/12/2019, 9:32 PMsvyatoslav.scherbina
08/13/2019, 7:30 AMThe docs still say you need to add the return. I guess this still needs to be updated?Yes, thanks.
myKtFun { dostuff()
return KotlinUnit() }
myKtFun
is likely not a function but a function-typed object here. Unit
is not represented as Void
when in is that deep. I.e. () -> Unit
type becomes () -> Void
, but (() -> Unit) -> Unit
becomes (() -> Unit) -> Void
.Patrick Jackson
08/14/2019, 12:55 PMreturn KotlinUnit()
in some situations. My usecase is a typealias Subscriber = () -> Unit
fun subscribe(subscriber: Subscriber) { ... }
Think this will ever go away? or is there some limitation that is blockingsvyatoslav.scherbina
08/14/2019, 1:14 PMsubscribe
case works properly for me.
Could you recheck?Patrick Jackson
08/14/2019, 1:20 PMtypealias Subscription = () -> Unit
val subscribe: (Subscriber) -> Subscription
using subscribe { }
from swift forces me to return KotlinUnit()
svyatoslav.scherbina
08/14/2019, 1:32 PMPatrick Jackson
08/14/2019, 1:40 PM() -> Unit) -> Unit)
ever be able to return Void from Swift. Bit of a pain point when using from swift.svyatoslav.scherbina
08/14/2019, 5:17 PM