iOS Developer Library

Developer

Foundation Framework Reference NSStreamDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSStreamDelegate

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(_ aStream: NSStream, handleEvent eventCode: 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.

    Availability

    Available in iOS 2.0 and later.

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