I am trying to implement a simple stepper which reflects its value onto a label. While using "Int(sender.value)" I am getting an error "Ambiguous use of value"
// ViewController.swift
// Stepper
//
// Created by Prabhu Konchada on 19/06/15.
// Copyright (c) 2015 Prabhu. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var StepperValue: UILabel!
@IBOutlet weak var OutputLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func StepperTap(sender: AnyObject) {
self.OutputLabel.text = String(Int(sender.value).description)
}
}
You can do like as follows :
else you have to convert
AnyObject
toUIStepper
like asas like :
Whole code as version 6.1 you have to just change to as with as! for 6.3.2: