Mac Developer Library

Developer

WebKit Framework Reference WebArchive Class Reference

Options
Deployment Target:

On This Page
Language:

WebArchive

Inheritance


Conforms To


Import Statement


Swift

import WebKit

Objective-C

@import WebKit;

Availability


Available in OS X v10.3.9 and later.

A WebArchive object represents a webpage that can be archived—for example, archived on disk or on the pasteboard. A WebArchive object contains the main resource, as well as the subresources and subframes of the main resource. The main resource can be an entire webpage, a portion of a webpage, or some other kind of data such as an image. Use this class to archive webpages, or place a portion of a webpage on the pasteboard, or to represent rich web content in any application.

  • Initializes the receiver with a resource and optional subresources and subframe archives..

    Declaration

    Swift

    init!(mainResource mainResource: WebResource!, subresources subresources: [AnyObject]!, subframeArchives subframeArchives: [AnyObject]!)

    Objective-C

    - (instancetype)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives

    Discussion

    This method initializes and returns the receiver by setting the main resource to mainResource, and setting the subresources and subframe archives if supplied. The subresources argument should be an array of WebResource objects or nil if none are specified. The subframeArchives should be and array of WebArchive objects used by the subframes or nil if none are specified.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Initializes and returns the receiver, specifying the initial content data.

    Declaration

    Swift

    init!(data data: NSData!)

    Objective-C

    - (instancetype)initWithData:(NSData *)data

    Discussion

    Use the data method to get the receiver’s data.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s main resource.

    Declaration

    Swift

    var mainResource: WebResource! { get }

    Objective-C

    @property(nonatomic, readonly, strong) WebResource *mainResource

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s subresources, or nil if there are none.

    Declaration

    Swift

    var subresources: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSArray *subresources

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns archives representing the receiver’s subresources or nil if there are none.

    Declaration

    Swift

    var subframeArchives: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSArray *subframeArchives

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the data representation of the receiver.

    Declaration

    Swift

    @NSCopying var data: NSData! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSData *data

    Discussion

    The data returned can be used to save the web archive to a file, to put it on the pasteboard using the WebArchivePboardType type, or used to initialize another web archive using the initWithData: method.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • The pasteboard type for this class.

    Declaration

    Swift

    let WebArchivePboardType: String

    Objective-C

    extern NSString *WebArchivePboardType;

    Constants

    • WebArchivePboardType

      WebArchivePboardType

      The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard.

      Available in OS X v10.3 and later.