Rick Umali is Programming Wordle in Swift (for the command line). With NCURSES

This video covers this project:

and these commits:

dda5f40 Makes guess rows in UI
0574301 Adds new main for swift-curses-mock2
5001622 Brings in SwiftCursesTerm

0:30 Starting…
1:55 A “tooey” (TUI)… I just made that up
3:40 I’m going to focus on making the GUI/TUI with SwiftCursesTerm
5:00 Converting from Darwin.nurses version would require a lot
6:00 swift-curses-mock2 follows swift-curses-mock1 (Darwin.nurses)
6:45 Going off-screen to change Package.swift
8:40 Brought in SwiftCursesTerm library
9:00 Going off-screen to commit this Package.swift change
9:45 commit 5001622
10:00 Making swift-curses-mock2 / We’re just going to copy Darwin.curses code
10:25 Going off-screen to make a new main program using this library
11:50 Clicking on “Add Editor on Right” to make side-by-side view
12:10 Renaming a file in Xcode (File.swift to main.swift)
13:00 swift build / dependency not used by any target
13:30 Found code in .build/checkouts directory / I couldn’t find this before…
14:30 “I like this… non-blocking calls” / In my day job I’m in NodeJS
15:25 Bringing in the dependency
16:00 Talking about the 80-character “gutter” / Word-wrap / Line and Column ruler
17:10 Learned some Xcode shortcuts (APPLE-0, APPLE-1, etc)
18:15 Going off-screen to add dependency
19:20 swift build / Error: cannot load module ‘Curses’ as ‘curses’
19:50 “I didn’t expect to run into an error here”
20:20 Maybe source needs to import Darwin.ncurses, instead of import curses
20:40 Looking at project issues to see if this has been discussed
21:35 Editing read-only file / Testing if this will build…
22:00 no such module Darwin.curses (mistake on my part)
23:30 I stare at error more closely…
24:35 I make a new project to check if it’s widespread/true error
25:35 I make swift5 project
26:10 “Whoops! Yikes!” / I think I made a mistake / I meant “swift package init”
27:45 I make a working swift5 project / I edit Package.swift
29:20 “There’s some semver stuff going on”
31:05 swift build works
31:30 I bring in minimal SwiftCursesTerm code
31:55 “Holy mackerel that worked!” / “So now I have a problem”
32:50 I start comparing .builds between swift5 and wordle-cli projects
33:05 Going off-screen / “Now you’re going to see me live debug this thing…”
35:25 “I have a feeling something’s left over from other work” / Going to do something radical
36:20 commit 0574301
37:30 swift build -v / Futile search
39:15 Here’s all the build stuff (build.db, sqlite3)
39:35 “The project is in a broken state”
39:50 Just an intuition: I’m going to get rid of my .build directory
40:25 After .build gone, I do a swift build
41:20 swift build worked! 😀
41:55 “So… we can continue!”
42:10 You saw me exercise a bit of intuition
42:30 My experience told me something was up… / I got lucky…
43:40 I bring in SwiftCursesTerm to confirm all is good
44:15 “It’s working properly”
45:00 I fuss over the last commit which announces an error / But it’s public now
46:00 Going off-screen to try to program in SwiftCursesTerm
49:30 First test run / Commenting on library
50:30 Trying different variations of term.addStrTo()
51:05 “The vi mode is not quite pure vi”
52:35 My co-worker who’s a hardcore vi user/ He’d laugh at my editing efforts here
53:05 Going off-screen to program more…
55:10 Forgot an argument label / No help, No jump to definition 😖
56:00 This makes think about argument labels / Some seem optional
57:05 Second test run / Very good
57:55 Bothers me that there’s no help… / Going off-screen
1:00:30 Feeling good about the progress
1:01:05 I look at addStr() auto-complete / I see the options…
1:02:15 Third run looks good
1:02:35 commit dda5f40

NCURSES

SwiftCursesTerm

semver

Music
DivKid

Rick is Programming Playlist