Please what key or method is used to collect user input in swift programming language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please what key or method is used to collect user input in swift programming language

21st Aug 2020, 6:02 PM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar
8 Answers
+ 3
You can use the readLine() method to get the user input. The method returns an optional string so you'll need to unwrap it. Ex; let s = readLine()!
21st Aug 2020, 8:41 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Can you share your code?
22nd Aug 2020, 3:15 AM
ChaoticDawg
ChaoticDawg - avatar
22nd Aug 2020, 4:09 AM
ChaoticDawg
ChaoticDawg - avatar
0
Thanks but, do you change the letter after "let" bcs i tried using let name = readLine and it said i can't redeclare 'name'
22nd Aug 2020, 3:08 AM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar
0
I actually went back to the lesson and got some help, but now it tells me type annotation missing
22nd Aug 2020, 3:24 AM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar
22nd Aug 2020, 3:25 AM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar
0
Wow, thanks a bunch, really appreciate
22nd Aug 2020, 7:49 AM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar
0
Also do you know how i can add graphics to my swift code
22nd Aug 2020, 7:50 AM
Ndukwe Nathaniel
Ndukwe Nathaniel - avatar