Xcode 6 Swift Converting String to Int in Text Fields

so i have been stuck with this problem for a very long time now and i cannot figure it out.

so my basic idea is that i have 2 textfields, where the user puts in a number (i don't know how to open the keypad yet would be nice if someone knew how) in both textfields and i want to divide those to numbers by each other.

< Label.text = (Textfield1.text) / (Textfield2.text) >

so i got 3 variables, a label, and two textfields, but i keeps giving me this error that string isn't convertible to a UIint8.

here is a screenshot with the code

Xcode 6 Swift Converting String to Int in Text Fields
Xcode 6 Swift Converting String to Int in Text Fields

here is the storyboard

Xcode 6 Swift Converting String to Int in Text Fields
Xcode 6 Swift Converting String to Int in Text Fields

PS: i am kinda new to this Xcode, so the problem might be REALLY obvious :/

here is the error code (it gave me an error when i did it without

let answer2 = textfield1.text.toInt()! / textfield2.text.toInt()!

2014-09-12 15:16:05.764 lb[3107:261572] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key ButtonO.' * First throw call stack: ( 0 CoreFoundation 0x000000010f2fb3e5 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000110e11967 objc_exception_throw + 45 2 CoreFoundation 0x000000010f2fb029 -[NSException raise] + 9 3 Foundation 0x000000010f713383 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x000000010f2453f0 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000010fe4716d -[UINib instantiateWithOwner:options:] + 1506 6 UIKit 0x000000010fca9d78 -[UIViewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x000000010fcaa368 -[UIViewController loadView] + 109 8 UIKit 0x000000010fcaa5d9 -[UIViewController loadViewIfRequired] + 75 9 UIKit 0x000000010fcaaa6e -[UIViewController view] + 27 10 UIKit 0x000000010fbcb2b1 -[UIWindow addRootViewControllerViewIfPossible] + 58 11 UIKit 0x000000010fbcb64a -[UIWindow _setHidden:forced:] + 276 12 UIKit 0x000000010fbd7a81 -[UIWindow makeKeyAndVisible] + 42 13 UIKit 0x000000010fb825cd -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628 14 UIKit 0x000000010fb8529c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350 15 UIKit 0x000000010fb84168 -[UIApplication workspaceDidEndTransaction:] + 179 16 FrontBoardServices 0x0000000112665513 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 17 CoreFoundation 0x000000010f230aac __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12 18 CoreFoundation 0x000000010f2267f5 __CFRunLoopDoBlocks + 341 19 CoreFoundation 0x000000010f2265b5 __CFRunLoopRun + 2389 20 CoreFoundation 0x000000010f2259f6 CFRunLoopRunSpecific + 470 21 UIKit 0x000000010fb83bdf -[UIApplication _run] + 413 22 UIKit 0x000000010fb86990 UIApplicationMain + 1282 23 lb 0x000000010edb6e5e top_level_code + 78 24 lb 0x000000010edb6e9a main + 42 25 libdyld.dylib 0x00000001113b3145 start + 1 26 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

In order to turn a string into an int, simply use .toInt() and it will give you an integer value to use. As for changing the keyboard, you can only bring up a keypad on an iPhone - if you try on an iPad, it will simply show the number side of the keyboard, but the user can change back to normal letters, therefore you need a custom keyboard on an iPad. Nonetheless, below is the code to get the keypad on the iPhone:

textField.keyboardType = UIKeyboardType.NumberPad

Hope that helps!