
Time Wasters for the iPad
Why this app?
A while ago, I wrote A Time Wasters Compendium for the Mac. It was my first attempt at writing games, albeit simple retro low-graphics games. I completed the project and, for a short while, I even played some of the games I had written. The problem was, I had written then for the Mac (that was the aim) and I couldn't be bothered to fire up the Mac to play the games.
So, this project has born. I have an iPad and I have some Mac games; how difficult could it be to port them across and play them in the iPad? Easy, huh?
This project is/was my attempt to port the games. And, yes, it turned out to be a lot easier than I was expecting. The Mac games had been created as xcFrameworks, so the game source code was isolated. The game front end was Mac specific, so would need a re-write but creating a simple front end on the iPad is fairly trivial.
Welcome to Time Wasters for the iPad. Oh, and, for good measure, it also runs on the Mac.
Key Learning Points
What did I want to achieve?
I'm not a gamer but, having put the effort into writing these games for the Mac, I did expect that I would play them more often than I have. The problem is that it is too much effort to put the Mac on just for playing games designed to be played, and discarded, quickly. I needed to have a re-think about the platform they were running on and, since I had an iPad that was always on, it was the perfect platform for them.
The primary purpose of this project was to see how quickly the games could be moved over to the iPad and to get a feel for the amount of remedial work I would need to do to get Mac code running on the iPad.
The aims are simple;
- An iPad app with the same games as the Mac version.
- Something that could also run in the Mac with no changes.
- Reuse as much of the framework code from the Mac.
- And, for the scare factor, create the whole app in Swift 6 mode.
I was very surprised to find that the games came over very easily. I created the framework project in the iPad sources and just copied the files from the Mac. They just ran... mostly.
All of the games suffered similar issues;
- Window sizes were fixed so didn't take account of the available space on the iPad.
- All of the games had custom, game specific, toolbars coded into the window itself. These looked very odd on the iPad..
- Some of the games had keyboard interfaces - they weren't going to work on the iPad.
All fixable.
Acknowledgements
Paul Hudson
Hacking with Swift+ live streams
.
Sound files
ZapSplat.com
.
Start page image files
pixabay.com
.
What it looks like
And the end result is...
The home screen has become a NavigationSplitView with the games listed on the left and the game on the right. When playing a game, the game list is automatically closed.

Game configuration is done by tapping on the gear icon at the top, which brings up the
configuration window:
Tapping the [i] icon next to a game brings up the game information sheet that
describes the game and displays credits where appropriate:
Tapping the (i) icon at the bottom of the game list just pops up an
about screen with program information.
Tapping a game button will open the selected game and close the game list. My current list of games includes:
- Mine Sweeper
- Wordcraft
- Snake Game
- Pyramid of Doom Adventure
- Number Combinations
- Tic Tac Toe/Noughts and Crosses
- Othello
- Matched Pairs
- Word Search
Minesweeper
Minesweeper is a classic game from the dim and distant past. The aim of the game is to identify all of the mines without clicking on one and setting it off.

Minesweeper rules are very simple. The board is divided into cells, with mines randomly distributed. To win, you need to open all the cells. The number on a cell shows the number of mines adjacent to it. Using this information, you can determine cells that are safe, and cells that contain mines. Cells suspected of being mines can be marked with a flag.
To win a game of Minesweeper, all non-mine cells must be opened without opening a mine. There is no score, but there is a timer recording the time taken to finish the game. Difficulty can be increased by adding mines or starting with a larger grid. You can do this via the settings panel. Beginner level is usually on an 8x8 or 9x9 board containing 10 mines, Intermediate is usually on a 16x16 board with 40 mines and expert is usually on a 22x22 board with 99 mines; however, you are free to customise board size and mine count.
The original version of this game was produced by Paul Hudson in his Hacking with Swift+ live streams . I extended the game to include;
- Variable game play levels.
- Sound feedback with an irritating ticking sound to add to the tension.
- End of game success and failure sounds.
- A game play popover to explain how to play the game.
- A fair amount of restructuring of the code.
The conversion of this game from the Mac version was pretty straight forward to begin with. The game converted and ran after very minor changes. However, it was not optimised for the iPad. Once the game was working, I had to adjust the view to resize itself to the available space and to implement a proper toolbar.
Back to game listWord Craft
WordCraft is a game where you have to use a limited number of letters to create a word. To make the game more challenging, you will be given a challenge to meet, such as a word with a specific number of letters or a word that starts with a specific letter.

There is no time limit to complete the challenge, but you must meet the challenge and you cannot use the same word more than once.
Letters you use to successfully create a word will be removed from the game board and replaced with a random set of replacement letters.
Like Minesweeper, Word Craft was a project created by Paul Hudson in his Hacking with Swift+ live streams . The game he presented worked well, but left a lovely amount of space for extension.
My extensions to this game were to:
- Added a keyboard interface so you can select letters using the keyboard rather than clicking them.
- Sound feedback while playing the game and when old tiles are removed and new tiles added.
- An optional log of used words so you can see words you have used before.
- An optional preview of the word you are creating.
- Popup feedback when you fail the game rule.
- The ability to refresh the rule if it is too difficult.
- A restart game button.
- A game play popover to explain how to play the game.
- Some restructuring of the code.
Converting this game took a little work. As with the other games, the ported code just worked and I had a playable game. However, the layout didn't fit the iPad structure. As a result, I modified the UI to move the recently used words list to the left, create a proper toolbar and to make the game play area adjust to the amount of screen space available.
Back to game listSnake Game
This is a classic game from the early days of computing. The premise is very simple but game play is surprisingly difficult the longer you play.

Your job is to guide the snake towards it's food. The snake will grow longer as it eats food. If it touches the borders or itself, it will die. As the game progresses and the snake grows longer and longer, you will need to work out routes to the food that will not cause the snake to die.
The game is very addictive and can be played for hours. It is a great way to spend a few minutes.
This game proved a real challenge to convert from the Mac. On the Mac the game controls were all via the keyboard where the space bar paused/started the game and the arrow keys controlled the direction change. None of this was possible on the iPad. To deal with this I experimented with chatGPT to see whether it could create a game controller for me. As you can see in the screenshot, it created a set of buttons that provided the basic functionality. I had to tweak a few things, but the results worked out well. I also retained the keyboard interface for when the game was played on the Mac.
Back to game listPyramid of Doom Adventure Game
Decades ago, when I was coding in Z80 assembler on the TRS-80, Scott Adams created some text adventure games. None of your fancy graphics here - you type commands, they get interpreted and the console updates with the results. The original code was written in C and has been stable for a very long time. As far as I know, nothing has happened to it in all that time.
This is my variant, written in Swift/SwiftUI. It took a long time to translate the original C code to Swift and a lot of debugging to makwe sure I was loading the original game files correctly. The result is Pyramid of Doom:

Converting this game went well, right up until I played it and an on-screen keyboard popped up and hid half of the playing area. I suppose it was always going to be a problem but I had hoped the impact wouldn't be too bad. It was. In the end, I coded a mini-keyboard that I embedded into the app that contained the minimum number of keys to play the game. It still takes up a fair amount of the playing area, but it is not as bad as the in-built keyboard was.
As with the other games, I had to fix the toolbar to become a 'real' toolbar and I moved the inventory to the left side.
Back to game listNumber Combinations Game
Number Combinations is a pretty straight forward game. Given four numbers and a result, work out the formula you need to generate the result. you must use all four digits and you can use + - * or / operators to achieve the result. You can force the order of calculation using brackets if you need to.

There is an option to display the formula if you're really stuck.
The main failing of the game at the moment is that divisions are integer divisions so, dividing 3 by 2 results in 1. This isn't ideal and can be used to solve most formulae. I want to address this at some point, but it's not a priority right now.
Conversion was a simple task of sorting out the toolbar. I'm not yet happy with the result as the game play is a fixed size. This one will require further work.
Back to game listTic Tac Toe Game
Better known to some of us oldies as 'Noughts and Crosses', Tic-Tac-Toe is a classic game that has been played for centuries. It is a simple game that can be played by two people or, in our case, one player against a a fiendish computer.

The game is played on a 3x3 grid, and each player takes turns placing their mark in a square. The player who gets three in a row horizontally, vertically, or diagonally wins the game.
The game is simple, but quite hard to win against the AI built into the computer. Can you beat the computer?
Conversion was simple and took very little work. I am still undecided whether to scale the game board or not.
Back to game listOthello
Othello is a strategy board game for two players (you and the computer), played on an 8 by 8 board. The game traditionally begins with four discs placed in the middle of the board. The computer will randomly select who goes first. The player always plays black and the computer white. There is no advantage to the colour of the pieces.

You must place a disc on the board, in such a way that there is at least one straight (horizontal, vertical, or diagonal) occupied line between the new disc and another of your discs, with one or more contiguous computer pieces between them.
After placing the disc, the opposition discs flip lying on a straight line between the new disc and any existing discs. All flipped discs are now yours. Now the computer plays. This computer operates under the same rules, with the roles reversed: it lays down a disc, causing your discs to flip.
Where there are no moves available, you or the computer skips their move and control reverts to the other player. The game ends when the board is full or neither player can move. At this time, the winner is determined by who has the most face up discs.
I had several problems with the sidebar on this game. In the end I converted the view into a NavigationSplitView and moved the sidebar content from the right to the left side. The game play worked unchanged, which was a bonus.
Back to game listMatched Pairs
I have logic games, numerical games and word game, so it seemed about time I had a memory game. Matched Pairs is it.

The premise of the game is simple. You are presented with a grid of face down playing cards and your job is to match pairs of cards. Click ona card and it turns face up. Click a second card and that turns face up too. If they match, the cards are removed from the game. If they don't match, they remain face up until you click a third card. At that point, the previous two turn face down.
All you have to do is remember what card was where in the grid.
As an added fun factor, the game can be configured such that the cards will automatically be turned face down after a set time (between 2 and 20 seconds). There are also easy, medium and hard levels where the number of cards changes, so testing your memory.
There is a leader board for all three levels which is based on the time it takes to match all of the cards.
One of my aims in this game was to include more animations. I've been able to animate the countdown timer before cards auto-flip back to face down and to animate the cards turning over. Plan is to animate dealing the cards at the start of the game - it's on my To Do list.
Conversion from the iPad was more difficult with this one as I needed the game board to resize to the available space. This was complicated by the game having options that could change the number of cards in play. Some messing with GeometryReader sorted this out for me.
Back to game listWord Search
I've always been fascinated by word search games so it's only logical that I get one into the compendium. This game presents a 14x14 grid of letters and 14 words to find. The words are between 3 and 12 letters long and may appear in the grid horizontally, vertically or diagonally. Just to add to the fun they may also be presented backwards.

The player identifies a word by clicking on the first and last letter. Assuming the word selected matches one of the words to be found, it will be highlighted on the game board and in the list. All words will exist somewhere on the grid.
The time taken to find all the words will be recorded and used to maintain a leader board of the five fastest times.
The game supports three levels of play:
- Easy - where words are arranged left to right or top to bottom,
- Medium - where words are left to right, right to left, top to bottom or bottom to top,
- Hard - where words are arranged in all vertical, horizontal or diagonal directions.
Recognising that this can be a difficult game to complete, there is also a hint mode where the player can long press on a word and all occurrences of the first letter of that word will be highlighted. So as to not make the game too easy, they are only highlighted for 2 seconds and it incurs a 10 second penalty on your score.
This game was a real pain to convert. The basic functionality came over easily, but the 'found word' highlight is achieved by layering a line over the top of the grid below. In the first conversion this went horribly wrong and the highlight, while it appeared, was offset from the word it was supposed to be highlighting. That's been sorted out. However, I still have sizing problems with the board on smaller screens. This is on the to-do list to be sorted out.
Hint mode proved difficult. I didn't want to throw it away but I didn't have a keyboard for the user to select a letter. The system of highlighting the first letter of one of the target words is the best compromise I could come up with without over complicating a simple game.
Back to game listWhere is it?
Can I have a copy?
The code is currently in development and I am sorting out the issues that remain from the conversion as well as making some style tweaks. As soon as I finish this work, I will upload the code to GitHub.
Testimonials
Am I really any good?
Don't take my word for my abilities, take a look at other peoples opinions about me.