Mastermind with SwiftUI

The mastermind classic number guessing game made for iPhone and iPad devices in SwiftUI With XCode This application was built with the purpose of exploring SwiftUI and The Composable Architecture for ios app development.

How to run code

  1. Download this repository
  2. Open Mastermind_with_SwiftUIApp.xcodeproj in Xcode
  3. Choose the appropriate device and run [Command]+ [R] in Xcode. For the best result, the ios 13 or later is recommended.


  • This project has been developed on Xcode 13 with SwiftUI 3.0
  • Compatible with iOS 15, iPadOS 15, macOS 12, and watchOS 12
  • To play the game, the device is required to connect to the internet.

Playing The Game

  • Select the difficulty levels with “Apprentice level” range from number 0 to 7, or “Master level” range from number 0 to 9.
  • Press “Start” to start palying the game.
  • Input 4 different numbers to guess the master set of 4 numbers.
  • Press the “checkmark” circle button to submit your guess.
  • The result shows correct numbers with B, correct numbers at the correct positions with A
  • Each game have 10 chance to guess the master set!


View Github