I am new to Objective-C and XCode and I'm trying to learn something new. Is there any way to read string from stdin using swift ? Something like cin in C++ ?
Just as with Objective-C, you can use NSFileHandle
:
let standardInput = NSFileHandle.fileHandleWithStandardInput()
let input = standardInput.availableData
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With