Swift Mapping for Local Classes
On this page:
Mapped Swift Class
A local Slice class is mapped to a Swift protocol with the same name. For example:
Slice
module Ice
{
local class ConnectionInfo
{
...
}
}
is mapped to the Swift protocol ConnectionInfo:
Swift
public protocol ConnectionInfo: AnyObject {
...
}
LocalObject in Swift
Like local interfaces, local Slice classes implicitly derive from LocalObject, which is mapped to AnyObject in Swift.
Mapping for Inheritance in Swift
A local Slice class can extend another local Slice class, and can implement one or more local Slice interfaces. Both extends and implements are mapped to protocol inheritance. For example:
Slice
module M
{
local interface A {}
local interface B {}
local class C implements A, B {}
local class D extends C {}
}
is mapped to:
Swift
public protocol A: AnyObject {}
public protocol B: AnyObject {}
public protocol C: A, B {}
public protocol D: C {}