@@ -478,17 +478,32 @@ Import the module we defined in our `module.modulemap`,
478
478
import SwiftHaskell
479
479
```
480
480
481
- Add a new label to the window in ` MainMenu.xib ` for us to write
482
- the result of our Haskell function ` square ` into, and add it as
483
- an ` @IBOutlet ` to the ` AppDelegate ` :
481
+ Let's add a new label to the window for us to write the result
482
+ of our Haskell function ` square ` into. Open ` MainMenu.xib ` and
483
+ select the window object in the left sidebar to bring it into
484
+ view. Then drag in a label from the object library in the right
485
+ sidebar into the window:
486
+
487
+ ![ Add a label] ( tutorial/xcode-ib-add-label.png )
488
+
489
+ Now option-click on ` AppDelegate.swift ` in the file list to open
490
+ it in an assistant editor. Holding the control key, drag the
491
+ label from the window into the ` AppDelegate ` class to add and
492
+ connect a new ` @IBOutlet ` :
493
+
494
+ ![ Add and connect the label outlet] ( tutorial/xcode-ib-add-label-outlet.png )
495
+
496
+ ![ Name the outlet] ( tutorial/xcode-ib-label-outlet-dialog.png )
497
+
498
+ Adding the outlet will add a new property to the ` AppDelegate ` :
484
499
485
500
``` swift
486
501
@IBOutlet weak var label: NSTextField!
487
502
```
488
503
489
- We already have our Haskell library's header imported, so we
490
- can just call the exported ` square ` function. Add this to
491
- ` applicationDidFinishLaunching ` :
504
+ With the ` SwiftHaskell ` module imported and a label connected,
505
+ let's call ` square ` and display its result in the label. Add
506
+ this to ` applicationDidFinishLaunching ` :
492
507
493
508
``` swift
494
509
label.stringValue = " \( square (5 )) "
0 commit comments