Swift input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Swift input

In swift, how do I require input in one of my codes?

6th May 2018, 9:36 PM
Wolverine88
Wolverine88 - avatar
5 Answers
+ 5
I had the same problem before and the answer is YOU CANNOT. I guess this is because Swift is made for iOS app development therefore your inputs would be buttons, textfields .....
6th May 2018, 9:56 PM
Gleb Koval
Gleb Koval - avatar
0
readLine()
10th Nov 2020, 10:25 AM
RAMAZAN AKBAL
RAMAZAN AKBAL - avatar
0
Check the Swift tutorial here.
23rd Dec 2020, 12:50 PM
Sonic
Sonic - avatar
0
According to Apple Documentation, The Official way of taking input from using in REPL is “if let userInput = readLine() { // Do Stuff with the Variable }
13th May 2021, 7:21 AM
Pawel Zabinski
Pawel Zabinski - avatar
0
yes but it doesn't seem to work with boolean values
19th Sep 2022, 4:25 PM
sahil somyani
sahil somyani - avatar