Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Objective-C 和 XCode 的新手,我正在尝试学习新东西。有没有办法使用 swift 从标准输入读取字符串?C++ 中的 cin 之类的东西?
就像使用 Objective-C 一样,您可以使用NSFileHandle:
NSFileHandle
let standardInput = NSFileHandle.fileHandleWithStandardInput() let input = standardInput.availableData