SwiftUI Coding Katas

As I’ve been teaching myself SwiftUI, I like to run through the following coding katas. Note that they’re katas, not one-time exercises. Run through them repeatedly, from scratch, to start exercising your SwiftUI muscles on a regular basis.

Tic Tac Toe

Create a tic tac toe game in SwiftUI. To save time, you may use the SF Symbols characters “xmark”, “circle”, and “square.dotted” to represent X, O, and empty spaces, respectively. Game should allow two players to alternate moves, and indicate when a player wins (showing the 3 in a row) or that the game is a tie. There should also be a way to start a new game. For extra credit, add a computer player.

Chess

Here are some Unicode glyphs for chess pieces:

♚♛♝♞♜♟ ♔♕♗♘♖♙

Write a SwiftUI app to allow two players to play chess on a chessboard. (Note that each player should have a white square on the right side of their end of the board.)

Master-Detail

Using the JSON file from:

https://jsonlint.com/datasets/us-states-with-detail

Create a master-detail app with an alphabetical list of state names that link to a detail page for each state with the other data. The neighboring states list should link to those states’ detail views. You may include the state data as a static resource, but for extra credit, have your app download the JSON data directly.

API Calls

Using the Wikipedia API calls:
https://en.wikipedia.org/w/api.php?action=query&format=json&list=recentchanges&formatversion=2

and

https://en.wikipedia.org/w/api.php?action=parse&format=json&page=<Page_Name>&prop=text&formatversion=2

Create a master-detail app listing the recent changes on Wikipedia and letting you click through to the page within the app.

John Brewer