Sam
03/28/2018, 1:45 PM//Kotlin class taking an array of functions
class Store (private val repositories: Map<String, Repository<*>>,
private val middleware: List<Middleware> = emptyList()){
//The function definitions
typealias DispatchFunction = (cmd: Command) -> Unit
typealias Middleware = (dispatch: DispatchFunction, repositories: Map<String, Repository<*>>) -> (DispatchFunction) -> DispatchFunction
//The ObjC header file that is generated
-(instancetype)initWithRepositories:(NSDictionary<NSString*, id<PistachioRepository>>*)repositories middleware:(NSArray<PistachioStdlibUnit*(^)(id<PistachioCommand>)(^)(PistachioStdlibUnit*(^)(id<PistachioCommand>))(^)(PistachioStdlibUnit*(^)(id<PistachioCommand>), NSDictionary<NSString*, id<PistachioRepository>>*)>*)middleware NS_SWIFT_NAME(init(repositories:middleware:)) NS_DESIGNATED_INITIALIZER;
The error message is Pistachio.h:86:168: Block pointer to non-function type is invalid
. Admittedly this is not a pretty function header and I'll probably refactor it since it seems to be a little too functional for ObjC. The code with the issue can be found at https://github.com/samus/pistachio/commit/4537d11648563596db6be22a53bb72a38a6be9eesvyatoslav.scherbina
03/28/2018, 4:30 PM