UAActionRegistry

@interface UAActionRegistry : NSObject

This class is responsible for runtime-persisting actions and associating them with names and predicates.

  • A set of the current registered entries

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSSet<NSMutableDictionary *> *_Nonnull registeredEntries;

    Swift

    var registeredEntries: Set<NSMutableDictionary> { get }
  • Factory method to create an action registry with the default action entries.

    Declaration

    Objective-C

    + (nonnull instancetype)defaultRegistry;

    Swift

    class func `default`() -> Self

    Return Value

    An action registry with the default action entries.

  • Registers an action with a predicate.

    If another entry is registered under specified name, it will be removed from that entry and used for the new action.

    Declaration

    Objective-C

    - (BOOL)registerAction:(nonnull UAAction *)action
                      name:(nonnull NSString *)name
                 predicate:(nullable UAActionPredicate)predicate;

    Swift

    func register(_ action: UAAction, name: String, predicate: UAActionPredicate? = nil) -> Bool

    Parameters

    action

    Action to be performed

    name

    Name of the action

    predicate

    A predicate that is evaluated to determine if the action should be performed

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because the name conflicts with a reserved action, the name is nil, or the action is nil.

  • Registers an action class with a predicate.

    If another entry is registered under specified name, it will be removed from that entry and used for the new action.

    Declaration

    Objective-C

    - (BOOL)registerActionClass:(nonnull Class)actionClass
                           name:(nonnull NSString *)name
                      predicate:(nullable UAActionPredicate)predicate;

    Swift

    func registerActionClass(_ actionClass: AnyClass, name: String, predicate: UAActionPredicate? = nil) -> Bool

    Parameters

    actionClass

    Action class for the action to be performed

    name

    Name of the action

    predicate

    A predicate that is evaluated to determine if the action should be performed

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Registers an action with a predicate.

    If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.

    Declaration

    Objective-C

    - (BOOL)registerAction:(nonnull UAAction *)action
                     names:(nonnull NSArray *)names
                 predicate:(nullable UAActionPredicate)predicate;

    Swift

    func register(_ action: UAAction, names: [Any], predicate: UAActionPredicate? = nil) -> Bool

    Parameters

    action

    Action to be performed

    names

    An array of names for the registry

    predicate

    A predicate that is evaluated to determine if the action should be performed

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Registers an action class with a predicate.

    If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.

    Declaration

    Objective-C

    - (BOOL)registerActionClass:(nonnull Class)actionClass
                          names:(nonnull NSArray *)names
                      predicate:(nullable UAActionPredicate)predicate;

    Swift

    func registerActionClass(_ actionClass: AnyClass, names: [Any], predicate: UAActionPredicate? = nil) -> Bool

    Parameters

    actionClass

    Action class for the action to be performed

    names

    An array of names for the registry

    predicate

    A predicate that is evaluated to determine if the action should be performed

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Registers an action.

    If another entry is registered under specified name, it will be removed from that entry and used for the new action.

    Declaration

    Objective-C

    - (BOOL)registerAction:(nonnull UAAction *)action name:(nonnull NSString *)name;

    Swift

    func register(_ action: UAAction, name: String) -> Bool

    Parameters

    action

    Action to be performed

    name

    Name of the action

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because the name conflicts with a reserved action, the name is nil, or the action is nil.

  • Registers an action.

    If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.

    Declaration

    Objective-C

    - (BOOL)registerAction:(nonnull UAAction *)action
                     names:(nonnull NSArray *)names;

    Swift

    func register(_ action: UAAction, names: [Any]) -> Bool

    Parameters

    action

    Action to be performed

    names

    An array of names for the registry

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Registers an action class.

    If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.

    Declaration

    Objective-C

    - (BOOL)registerActionClass:(nonnull Class)actionClass
                           name:(nonnull NSString *)name;

    Swift

    func registerActionClass(_ actionClass: AnyClass, name: String) -> Bool

    Parameters

    actionClass

    Action class for the action to be performed

    name

    Name of the action

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Registers an action class.

    If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.

    Declaration

    Objective-C

    - (BOOL)registerActionClass:(nonnull Class)actionClass
                          names:(nonnull NSArray *)names;

    Swift

    func registerActionClass(_ actionClass: AnyClass, names: [Any]) -> Bool

    Parameters

    actionClass

    Action class for the action to be performed

    names

    An array of names for the registry

    Return Value

    YES if the action was registered, NO if the action was unable to be registered because one of the names conflicts with a reserved action, no names were specified, or the action is nil.

  • Returns a registered action for a given name.

    Declaration

    Objective-C

    - (nullable UAActionRegistryEntry *)registryEntryWithName:
        (nonnull NSString *)name;

    Swift

    func registryEntry(withName name: String) -> UAActionRegistryEntry?

    Parameters

    name

    The name of the action

    Return Value

    The UAActionRegistryEntry for the name or alias if registered, nil otherwise.

  • Adds a situation override action to be used instead of the default registered action for a given situation. A nil action will cause the entry to be cleared.

    Declaration

    Objective-C

    - (BOOL)addSituationOverride:(UASituation)situation
                forEntryWithName:(nonnull NSString *)name
                          action:(nullable UAAction *)action;

    Swift

    func addSituationOverride(_ situation: UASituation, forEntryWithName name: String, action: UAAction?) -> Bool

    Parameters

    situation

    The situation to override

    name

    Name of the registered entry

    action

    Action to be performed

    Return Value

    YES if the action was added to the entry for the situation override. NO if the entry is unable to be found with the given name, if the situation is nil, or if the registered entry is reserved.

  • Updates the predicate for a registered entry.

    Declaration

    Objective-C

    - (BOOL)updatePredicate:(nullable UAActionPredicate)predicate
           forEntryWithName:(nonnull NSString *)name;

    Swift

    func updatePredicate(_ predicate: UAActionPredicate?, forEntryWithName name: String) -> Bool

    Parameters

    predicate

    Predicate to update or nil to clear the current predicate

    name

    Name of the registered entry

    Return Value

    YES if the predicate was updated for the entry. NO if the entry is unable to be found with the given name or if the registered entry is reserved.

  • Updates the default action for a registered entry.

    Declaration

    Objective-C

    - (BOOL)updateAction:(nonnull UAAction *)action
        forEntryWithName:(nonnull NSString *)name;

    Swift

    func update(_ action: UAAction, forEntryWithName name: String) -> Bool

    Parameters

    action

    Action to update for the entry

    name

    Name of the registered entry

    Return Value

    YES if the action was updated for the entry. NO if the entry is unable to be found with the given name or if the registered entry is reserved.

  • Updates the default action for a registered entry.

    Declaration

    Objective-C

    - (BOOL)updateActionClass:(nonnull Class)actionClass
             forEntryWithName:(nonnull NSString *)name;

    Swift

    func updateActionClass(_ actionClass: AnyClass, forEntryWithName name: String) -> Bool

    Parameters

    actionClass

    Class of action to update for the entry

    name

    Name of the registered entry

    Return Value

    YES if the action was updated for the entry. NO if the entry is unable to be found with the given name or if the registered entry is reserved.

  • Removes a name for a registered entry.

    Declaration

    Objective-C

    - (BOOL)removeName:(nonnull NSString *)name;

    Swift

    func removeName(_ name: String) -> Bool

    Parameters

    name

    The name to remove

    Return Value

    YES if the name was removed from a registered entry. NO if the name is a reserved action name and is unable to be removed.

  • Removes an entry and all of its registered names.

    Declaration

    Objective-C

    - (BOOL)removeEntryWithName:(nonnull NSString *)name;

    Swift

    func removeEntry(withName name: String) -> Bool

    Parameters

    name

    The name of the entry to remove.

    Return Value

    YES if the entry was removed from a registry. NO if the entry is a reserved action and is unable to be removed.

  • Adds a name to a registered entry.

    Declaration

    Objective-C

    - (BOOL)addName:(nonnull NSString *)name
        forEntryWithName:(nonnull NSString *)entryName;

    Swift

    func addName(_ name: String, forEntryWithName entryName: String) -> Bool

    Parameters

    name

    The name to add to the registered entry.

    entryName

    The name of registered entry.

    Return Value

    YES if the name was added to the entry. NO if no entry was found for ‘entryName’, the entry is reserved, or the name is already used for a reserved entry.