Archived
This forum has been archived. Please start a new discussion on GitHub.
Optional return value / Objective C language mapping
I am looking for an example that explains how to use optional return values in Objective C.
Given the following slice idl:
interface Foo
{
optional(1) int bar();
};
The Objective C protocol looks like:
@protocol Foo <NSObject>
-(id) bar:(ICECurrent *)current;
@end
Which type is used for the return value? NSNumber ?
Given the following slice idl:
interface Foo
{
optional(1) int bar();
};
The Objective C protocol looks like:
@protocol Foo <NSObject>
-(id) bar:(ICECurrent *)current;
@end
Which type is used for the return value? NSNumber ?
0
Comments
-
Hi,
Yes here the return value is mapped to NSNumber see
https://doc.zeroc.com/display/Ice36/Objective-C+Mapping+for+Operations#Objective-CMappingforOperations-OptionalParametersinObjective-C0 -
You might also be interested in the Objetive-C optional demo https://github.com/zeroc-ice/ice-demos/tree/3.6/objective-c/Ice/optional0