Is there anyway to ensure that unit ISN'T converte...
# kotlin-native
k
Is there anyway to ensure that unit ISN'T converted into void when exporting as framework for IOS? I've had an issue with higher order functions using Kotlin unit and where their meant to be passed into using void. E.G ((Type) -> Unit, (Type) -> Unit) -> Unit Where those functions would be passed into somewhere that takes (Type) -> Unit as a parameter, in the first part you Unit becomes KotlinUnit and in the 2nd it becomes Void making them incompatible
a
Hello, @Kweku! Can you please illustrate this problem with an example, something like - what exactly you’d like to get instead of void?
k
Copy code
class Interactor(
    private val Repository: RepositoryInterface,
    private val success: (List<Type>) -> Unit,
    private val failure: Error) -> Unit): InteractorInterface

I'm using partial application to pass in the repository using DI then the two functions are added by whatever class that uses the Interactor. The interactorCreator function already has the repository passed in it

class Controller( private val interactorCreator:((List<Type>) -> Unit), ((Error) -> Unit)) -> InteractorInterface)
So in the first case unit becomes void but in the second it becomes KotlinUnit when exported as a Objc framework meaning that the functions can't be passed into the constructor. I've searched around and it's normal behaviour for Unit and I don't think it's possible to get the second type to convert to Void so am looking to get the first type to convert to KotlinUnit