Contents

subdata(with:)

Returns a new data object containing the data object’s bytes that fall within the limits specified by a given range.

Declaration

func subdata(with range: NSRange) -> Data

Parameters

  • range:

    The range in the receiver from which to get the data. If this range is not within the data object’s range of bytes, Rangeexception is raised.

Return Value

A data object containing the receiver’s bytes that fall within the limits specified by range.

Discussion

A sample using this method can be found in Working With Binary Data.

See Also

Finding Data