Component implementation structure - Swift
Create a simple non-ui component
Component Structure
Component Protocol
ComponentSubscriberBasic code structure
import CloneableCore
import CloneablePlatformiOS
public class SampleComponent: ComponentSubscriber {
// Required properties properties
var staticComponentID: String
var dynamicComponentID: String
var component: DeployedWorkflow_components
// Implementing protocol functions
// Called just prior to the platform sending it's first inputs to the component
required init(dynamicComponentID: String, staticComponentID: String, component: DeployedWorkflow_components) {
self.dynamicComponentID = dynamicComponentID
self.staticComponentID = staticComponentID
self.component = component
// Additional logic to run when init is called can be placed here
...
// Required call to register this instance of the component with the cloneable framework
// workflowFramework is a global variable which holds reference to the framework which is running the workflows
workflowFramework?.subscribeComponent(subscriber: self, dynamicComponentID: dynamicComponentID, staticComponentID: staticComponentID)
}
public func componentWillDeInit(final: Bool) {
// Handle de-initialization logic here
}
public func acceptNewInputs(inputs: [DataInput]) {
// Handle new inputs here
}
}
staticComponentID
dynamicComponentID
component: DeployedWorkflow_components
Workflow Component TypeSubscribe to the workflow framework
Accepting Inputs
Grouping of inputs
Working with the input data
AnyCloneableDataSending Outputs
AnyCloneableDataCall the output function on workflowFramework
Notifying the component that it will de-initialize
Last updated

