---
title: "init(url:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/inputstream/init(url:)-1lfmj"
---

# init(url:)

Initializes and returns an NSInputStream object that reads data from the file at a given URL.

## Declaration

```swift
init?(url: URL)
```

## Parameters

- `url`: The URL to the file.

## Return Value

Return Value An initialized NSInputStream object that reads data from the file at url.

## Discussion

Discussion The stream must be opened before it can be used.

## See Also

### Creating Streams

- [init(data:)](foundation/inputstream/init(data:).md)
- [init(fileAtPath:)](foundation/inputstream/init(fileatpath:).md)
