-3

XCODE/SWIFT: Trying to get the input from my textfield named "numberInpt" to generate a value as an integer rather then a string. It uses a number pad if that is relevant.

Reece
  • 3
  • 2
  • possible duplicate of https://stackoverflow.com/a/34294660/2303865 – Leo Dabus May 21 '20 at 01:46
  • Does this answer your question? [Converting String to Int with Swift](https://stackoverflow.com/questions/24115141/converting-string-to-int-with-swift) – Magnas May 21 '20 at 04:56

1 Answers1

0

You can use a variation on Int(numberInpt.text)

Ceri Turner
  • 830
  • 2
  • 12
  • 36
  • So when I type "let nmbr = Int(numberInpt.text)" I get an error – Reece May 21 '20 at 01:57
  • @Reece, I'm guessing your error is that `numberInpt.text` is an optional. Check out the link Leo Dabus commented for how to handle this specific case. – Daniel May 21 '20 at 02:32