Preliminary documentation for Ice 3.7.1 Beta. Do not use in production applications. Refer to the space directory for other releases.

On this page:

Mapped Objective-C Protocol

A Slice local interface is mapped to an Objective-C protocol with the same name, for example:

Slice
["objc:prefix:ICE"]
module Ice
{
    local interface Communicator
    {
        ...
    }
}

is mapped to the Objective-C protocol ICECommunicator:

Objective-C
@protocol ICECommunicator <NSObject>
...
@end

The delegate metadata allows you to map a local interface with a single operation to an Objective-C block. For example:

Slice
["objc:prefix:ICE"]
module Ice
{
    ["delegate"] local interface ValueFactory
    {
        Value create(string type);
    }
}

is mapped to:

Objective-C
typedef ICEObject* (^ICEValueFactory)(NSString*);

LocalObject in Objective-C

All Slice local interfaces implicitly derive from LocalObject, which is mapped to ICELocalObject in Objective-C:

Objective-C
@interface ICELocalObject : NSObject
{
   // internal member
}
@end 

Mapping for Local Interface Inheritance in Objective-C

Inheritance of local Slice interfaces is mapped to protocol inheritance in Objective-C. For example:

Slice
module M
{
    local interface A {}
    local interface B extends A {}
    local interface C extends A {}
    local interface D extends B, C {} 
} 

is mapped to:

Objective-C
@protocol MA <NSObject>
@end

@protocol MB <MA>
@end

@protocol MC <MA>
@end

@protocol MD <MB, MC>
@end

  • No labels