TerminalFactorySpi
public protocol TerminalFactorySpi : AnyObject
The TerminalFactorySpi class defines the service provider interface.
Applications do not access this class directly, instead see
TerminalFactory.
Service providers that want to write a new implementation should define
a concrete subclass of TerminalFactorySpi with a constructor that takes
an Any as parameter. That class needs to be registered in a Provider.
The engine type is TerminalFactory. Service providers also need to
implement subclasses of the protocol classes CardTerminals,
CardTerminal, Card, and CardChannel.
For example:
module MyModule
file MyProvider.swift:
import SmartCardIO
public class MyProvider: Provider {
public init() {
super.init(name: "MyProvider",
version: 1.0,
info: "Smart Card Example")
put(key: "TerminalFactory.MyType",
value: "MyModule.MySpi")
}
}
file MySpi.swift:
import SmartCardIO
public class MySpi: TerminalFactoySpi {
public required init(parameter: Any) throws {
// initialize as appropriate
}
public func engineTerminals() -> CardTerminals {
// add implementation code here
}
}
See also
See also
Version
1.0
Date
8 Dec 2017
-
Constructs a new TerminalFactorySpi object.
This class is part of the service provider interface and not accessed directly by applications. Applications should use TerminalFactory objects, which can be obtained by calling
TerminalFactory.shared(type:params:provider:)method.Concrete subclasses should define a constructor that takes an
Anyas parameter. It will be invoked when an application callsTerminalFactory.shared(type:params:provider:)method and receives theparamsobject specified by the application.Throws
CardError.illegalArgumentif the parameter contains invalid valueDeclaration
Swift
init(parameter: Any) throwsParameters
parameterthe parameter
-
Returns the CardTerminals created by this factory.
Declaration
Swift
func engineTerminals() -> CardTerminalsReturn Value
the CardTerminals created by this factory