Mac Developer Library

Developer

WebKit Framework Reference WebResource Class Reference

Options
Deployment Target:

On This Page
Language:

WebResource

A WebResource object represents a downloaded URL. It encapsulates the data of the download as well as other resource properties such as the URL, MIME type, and frame name. More...

Inheritance


Conforms To


Import Statement


import WebKit @import WebKit;

Availability


Available in OS X v10.3.9 and later.
  • Initializes and returns a web resource instance.

    Declaration

    Swift

    init!(data data: NSData!, URL URL: NSURL!, MIMEType MIMEType: String!, textEncodingName textEncodingName: String!, frameName frameName: String!)

    Objective-C

    - (instancetype)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName

    Parameters

    data

    The download data.

    URL

    The download URL.

    MIMEType

    The MIME type of the data.

    textEncodingName

    The IANA encoding name (for example, “utf-8” or “utf-16”). This parameter may be nil.

    frameName

    The name of the frame. Use this parameter if the resource represents the contents of an entire HTML frame; otherwise pass nil.

    Return Value

    An initialized web resource.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s data.

    Declaration

    Swift

    @NSCopying var data: NSData! { get }

    Objective-C

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

    Return Value

    The download data.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s URL.

    Declaration

    Swift

    var URL: NSURL! { get }

    Objective-C

    @property(nonatomic, readonly, strong) NSURL *URL

    Return Value

    The download URL.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s MIME type.

    Declaration

    Swift

    var MIMEType: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *MIMEType

    Return Value

    The MIME type of the data.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s text encoding name.

    Declaration

    Swift

    var textEncodingName: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *textEncodingName

    Return Value

    The IANA encoding name (for example, “utf-8” or “utf-16”), or nil if the name does not exist.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.

  • Returns the receiver’s frame name.

    Declaration

    Swift

    var frameName: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *frameName

    Return Value

    The name of the frame. If the receiver does not represent the contents of an entire HTML frame, this method returns nil.

    Import Statement

    import WebKit

    Availability

    Available in OS X v10.3.9 and later.