iOS Developer Library

Developer

UIKit Framework Reference UIActivityItemProvider Class Reference

Options
Deployment Target:

On This Page
Language:

UIActivityItemProvider

A UIActivityItemProvider object is a proxy for data passed to an activity view controller. You can use a provider object in situations where you want to make data available for use by an activity but you want to delay providing that data until it is actually needed. For example, you might use a provider object to represent a large video file that needs to be processed before it can be shared to a user’s social media account. More...

Inheritance


Import Statement


import UIKit @import UIKit;

Availability


Available in iOS 6.0 and later.
  • Initializes and returns a provider object with the specified placeholder data.

    Declaration

    Swift

    init(placeholderItem placeholderItem: AnyObject)

    Objective-C

    - (instancetype)initWithPlaceholderItem:(id)placeholderItem

    Parameters

    placeholderItem

    An object that can stand in for the actual object you plan to create. The contents of the object may be empty but the class of the object must match the class of the object you plan to provide later.

    Return Value

    An initialized provider object.

    Import Statement

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • Generates and returns the actual data-bearing object.

    Declaration

    Swift

    func item() -> AnyObject!

    Objective-C

    - (id)item

    Discussion

    When the actual data-bearing object is required, this method is called by the provider object’s infrastructure. Subclasses must override this method and use it to perform whatever work is required to create the object and return it. You implement this method instead of the normal main method you would implement for operation objects. This method is called on a secondary thread of your app.

    The system provides no built-in progress indicator, so if generating the item may take a long time you should plan on providing feedback in your app yourself.

    Import Statement

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The placeholder object you specified at initialization time. (read-only)

    Declaration

    Swift

    var placeholderItem: AnyObject! { get }

    Objective-C

    @property(nonatomic, retain, readonly) id placeholderItem

    Import Statement

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The type of the activity object that is expecting the data. (read-only)

    Declaration

    Swift

    var activityType: String? { get }

    Objective-C

    @property(nonatomic, readonly) NSString *activityType

    Discussion

    The value of this property is nil until the user selects an activity. At that time, the value is set and the provider object is submitted to a queue for execution. Thus, you should access this value only after your object’s item method is called.

    Import Statement

    import UIKit

    Availability

    Available in iOS 6.0 and later.