iOS Developer Library

Developer

Foundation Framework Reference NSStreamDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSStreamDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in iOS 4.0 and later.

The NSStreamDelegate protocol defines the optional methods implemented by delegates of NSStream objects.

  • The delegate receives this message when a given event has occurred on a given stream.

    Declaration

    Swift

    optional func stream(_ theStream: NSStream, handleEvent streamEvent: NSStreamEvent)

    Objective-C

    - (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent

    Parameters

    theStream

    The stream on which streamEvent occurred.

    streamEvent

    The stream event that occurred.

    Discussion

    The delegate receives this message only if theStream is scheduled on a run loop. The message is sent on the stream object’s thread. The delegate should examine streamEvent to determine the appropriate action it should take.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in iOS 2.0 and later.

    Available as part of an informal protocol prior to iOS 4.0.