public protocol Feature : FeatureDefinition

Classes conforming to Feature represent an always-available feature that can perform actions.

To define such a feature, conform to this protocol and declare static properties for the actions it supports, using the action(Action.Type) helper function. You then override prepare and use the actions builder to declare or publish those actions:

class DocumentManagementFeature: Feature, URLMapped {
    static let description = "Create, Open and Save documents"

    static let createNew = action(DocumentCreateAction.self)
    static let openDocument = action(DocumentOpenAction.self)
    static let closeDocument = action(DocumentCloseAction.self)
    static let saveDocument = action(DocumentSaveAction.self)

    static func prepare(actions: FeatureActionsBuilder) {

    static func urlMappings(routes: URLMappingsBuilder) {
        routes.send("create", to: createNew)
        routes.send("open", to: openDocument)

You can optionally override the default implementations of name and description of you want to change how the feature is presented in logging and debug UI.

-note: This type exists simply to allow protocol extenions on this type that are not to be inherited by ConditionalFeatureDefinition, e.g. the differing action() binding functions.


ConditionalFeature for features that can be enabled or disabled based on some condition.