Mac Developer Library

Developer

AddressBook Framework Reference ABActionDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

ABActionDelegate

The ABActionDelegate informal protocol allows you to populate the rollover menus of Address Book with custom items. You do this by implementing an Address Book action plug-in. The plug-in’s NSBundle must implement actionProperty:, titleForPerson:identifier: and performActionForPerson:identifier:.

Each action plug-in can implement only one action. Actions can only apply to items with labels. An action can display a simple window inside the Address Book application; if your action actions needs to do anything else, it should launch your own application to perform the action.

Use Xcode to create Address Book action plug-ins. Place action plug-ins in ~/Library/Address Book Plug-Ins or /Library/Address Book Plug-Ins, depending on the scope you want for the action.

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AddressBook

Objective-C

@import AddressBook;

Availability


Available in OS X v10.3 and later.
  • Sent to the delegate to perform the action.

    Declaration

    Swift

    func performActionForPerson(_ person: ABPerson!, identifier identifier: String!)

    Objective-C

    - (void)performActionForPerson:(ABPerson *)person identifier:(NSString *)identifier

    Parameters

    person

    The person on which the action will be taken.

    identifier

    The unique identifier of the selected value.

    Discussion

    If the property returned by actionProperty is a multivalue property, identifier contains the unique identifier of the value selected. The person being displayed in the Address Book application’s card view when the rollover menu is accesses is passed as person.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.3 and later.

  • Sent to the delegate to request the property the action applies to.

    Declaration

    Swift

    func actionProperty() -> String!

    Objective-C

    - (NSString *)actionProperty

    Return Value

    The property that the action applies to.

    Discussion

    See The documentation for property-list constants for the properties for person and group records.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.3 and later.

  • Sent to the delegate to determine whether the action should be enabled.

    Declaration

    Swift

    func shouldEnableActionForPerson(_ person: ABPerson!, identifier identifier: String!) -> Bool

    Objective-C

    - (BOOL)shouldEnableActionForPerson:(ABPerson *)person identifier:(NSString *)identifier

    Parameters

    person

    The person on which the action will be taken.

    identifier

    The unique identifier of the selected value.

    Return Value

    YEStrue if the action is applicable; otherwise, NOfalse.

    Discussion

    If the property returned by actionProperty is a multivalue property, identifier contains the unique identifier of the value selected.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.3 and later.

  • Sent to the delegate to request the title of the menu item for the action.

    Declaration

    Swift

    func titleForPerson(_ person: ABPerson!, identifier identifier: String!) -> String!

    Objective-C

    - (NSString *)titleForPerson:(ABPerson *)person identifier:(NSString *)identifier

    Parameters

    person

    The person on which the action will be taken.

    identifier

    The unique identifier of the value for which the menu item will be displayed.

    Return Value

    The title of the menu item for the action.

    Discussion

    If the property returned by actionProperty is a multivalue property, identifier contains the unique identifier of the value selected.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in OS X v10.3 and later.