Reputation: 109
The following code either runs or does not run the line println("test")
, which results in nothing bring printed to the console:
import UIKit
class ViewController: UIViewController
{
@IBOutlet weak var display: UILabel!
@IBAction func appendDigit(sender: UIButton) {
let digit = sender.currentTitle
println("test")
}
}
Relating to the following GUI:
The following is a screenshot of the console after the program is run and one of the number buttons is pressed:
I do not know if the line of code runs nor why, if it does, that it is not printing to the console.
Can someone please show me how to make it print to the console?
Upvotes: 0
Views: 1546
Reputation: 22212
I know is a litle late but if you're using Swift 2, you can only use print() to write something to the output. Apple has combined both println() and print() functions into one.
If you want to output something with a newline, you can set the appendNewline parameter to true.
Here is an example:
print("Hello new Print with newLine", appendNewline: true)
Upvotes: 0
Reputation: 1173
First, right click a button. Under Sent Events
check if there is an event handler set for Touch Up Inside
. If so, it might be incompatible with your method appendDigit
(wrong parameters maybe?) so you should disconnect it (using the little x
).
Next, ctrl-drag from your button to the appendDigit
method to hook up the event handler again.
Upvotes: 1