1

TemplateClass.m

+ (AnyPromise *) promisefunctionReturnThreeValus:(NSString *)sampleName {
return [self anotherPromiseFunction:sampleName].then(^(NSMutableDictionary *sampleDict) {
    DataArray *data = [DataArray dataArrayFromDict:sampleDict];
    PropertyArray *property = [PropertyArray PropertyArrayFromDict:sampleDict];

    if ([sampleDict objectForKey:NAME])
    {
        NameModel *name = [[NameModel alloc]initWithDictionary:[responseDict objectForKey:NAME]];
        return (PMKManifold(data,property,name));
    }
    else
    {
        return (PMKManifold(data,property,nil));
    }
});
}

well i can able to access this from objc using the below code

[TemplateClass promisefunctionReturnThreeValus:@"hello"].then(^(DataArray *data,PropertyArray *property,NameModel *name) {

  //Here i can able to access the three values data,property and name

}

But when i try to access this from swift

TemplateClass.promisefunctionReturnThreeValus(sampleName: "hello").then{ data,property,name in
  // it show me error  " Contextual closure type '(Any?) -> AnyPromise' expects 1 argument, but 3 were used in closure body "
}

i can able to access only data but not the other two i also tried debug it and print through log it show only the data of DataArray Object

lldb output

<DataArray : 0x1c0631340 count:1  value:{
"id" = 3631;
 }
 >
Ayyanar
  • 526
  • 1
  • 5
  • 10

0 Answers0