swift - error with Int function in Xcode 7 beta -
this question has answer here:
- .toint() removed in swift 2? 5 answers
i have error while testing code in xcode 7 beta, error between 2 asterisk
class viewcontroller: uiviewcontroller {
@iboutlet weak var agee: uitextfield! @iboutlet weak var labelage: uilabel! @ibaction func findage(sender: anyobject) { *var enteredage = agee!.text.toint()* if enteredage != nil { var catyears = enteredage! * 7 labelage.text = "your cat \(catyears) in cat years" } else { labelage.text = "please enter number in box" } }
@iboutlet var agee: uitextfield! @iboutlet var labelage: uilabel! @ibaction func findage(sender: anyobject) { if agee != nil { var enteredage = agee.text.toint() var catyears = enteredage! * 7 labelage.text = "your cat age \(catyears) in cat years" print(catyears) // check in logs } else { labelage.text = "please enter number in box" } }
just paste above code in project.
don't forget connect @iboutlets , @ibaction again[ctrl+drag] in assistant editor. otherwise you'll stuck in signal issue(sigabrt) hope helps!
Comments
Post a Comment