April 2015
Intermediate to advanced
556 pages
17h 47m
English
Now you are going to write a Cocoa app that uses NSTask to run ping (Figure 35.5).
Figure 35.5 Completed application
In Xcode, create a new project, iPing, of type Cocoa Application. Uncheck Create Document-Based Application. You will want a storyboard for this app, so ensure that Use Storyboards is checked.
Open ViewController.swift. First, remove all of the methods from ViewController that were added as part of the Xcode template. Then add several properties and a stub for an action method.
class ViewController: NSViewController {
@IBOutlet var outputView: NSTextView!
@IBOutlet weak var hostField: NSTextField!