Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB5699676: FileHandle should conform to TextOutputStream #11

Open
sindresorhus opened this issue Aug 11, 2019 · 0 comments
Open

FB5699676: FileHandle should conform to TextOutputStream #11

sindresorhus opened this issue Aug 11, 2019 · 0 comments

Comments

@sindresorhus
Copy link
Member

sindresorhus commented Aug 11, 2019

  • Date: 2019-02-13
  • Resolution: Open
  • Area: Foundation
  • OS: macOS 10.14
  • Type: Feature

Description

That would make it easier to work with stdout, stderr, and other file handles. For example, using stderr with Swift.print().

Currently, every project has to include this extension:

extension FileHandle: TextOutputStream {
	public func write(_ string: String) {
		write(string.data(using: .utf8)!)
	}
}

Swift 4.2

See: https://forums.swift.org/t/rework-print-by-adding-observable-standardoutput-and-standarderror-streams-to-standard-library/7775/3

Relevant Stack Overflow question: https://stackoverflow.com/questions/24041554/how-can-i-output-to-stderr-with-swift

Swift issue: https://bugs.swift.org/browse/SR-9918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant