SwiftUI implementation of the game Wordle.

Overview

Wordle In SwiftUI

This is my implementation of Wordle in SwiftUI.

Explaination

I know some of the code does not really make any sense, like random completion handlers and weird Enums that really nothing at all. This is because I'm working on a iOS application and I just pulled the Wordle code from that repo (it's private) and pasted it here.

The game (application) still works, I know the implementation and logic is kinda weird. This was the first solution I came up with, and the computations are fairly inexpensive since it's only a 5 letter word game.

Worlde.txt contains every single 5 letter word. That's what I use for making sure the input is valid.

'''
    let path = Bundle.main.path(forResource: "allowedWords", ofType: "txt") // file path for file "data.txt"
    let allowedWordsArray = try? String(contentsOfFile: path!, encoding: String.Encoding.utf8).split(separator: "\n")
    let allowedWordsHashTable = Set(allowedWordsArray!)
    AllowedWordsModel.allAllowedWords = allowedWordsHashTable
'''

Also this applications does not show any alerts, for e.g. when you enter a incorrect word, that's because in my other app the alert was represented in another SwiftUI view which was displayed with a UIHostingController(), but for this app I did not want to include any UIKit components unnecessarily so I left that part out.

Images

Extra

If you have any questions/suggestions, ping me or create an issue/pull-request and I'll respond.

You might also like...
🦁 🃏 📱 An animal matching puzzle card game– built with turn-based game engine boardgame.io and React-Native + React-Native-Web
🦁 🃏 📱 An animal matching puzzle card game– built with turn-based game engine boardgame.io and React-Native + React-Native-Web

Matchimals.fun an animal matching puzzle card game 🦁 🃏 🍎 Download for iOS from the App Store 🤖 Download for Android from the Google Play Store 🖥

Switshot is a game media manager helps you transfer your game media from Nintendo Switch to your phone, and manage your media just few taps.
Switshot is a game media manager helps you transfer your game media from Nintendo Switch to your phone, and manage your media just few taps.

Switshot is a game media manager helps you transfer your game media from Nintendo Switch to your phone, and manage your media just few taps.

Gravity Switch - A dynamic game that integrates swiping and tapping to create a fun interactive game

GravitySwitch Gravity Switch is a dynamic game that integrates swiping and tappi

FlagGuess-Game - A game to collect points by guessing flags
FlagGuess-Game - A game to collect points by guessing flags

Flag Guess Game A game to collect points by guessing flags! Wrong Choice

CardGameEngine - Prototyping a game engine for the Bang card game
CardGameEngine - Prototyping a game engine for the Bang card game

CardGameEngine Prototyping a game engine for the Bang card game. Features Engine is open source Powerful scripting language using JSON Card design is

Tic Tac Toe game developed in SwiftUI
Tic Tac Toe game developed in SwiftUI

TicTacToe Tic Tac Toe game developed in SwiftUI Requirements macOS 11.1 Big Sur Xcode 12.3 iOS 14 Getting Started Clone the Repository Royalty free au

A 2048 game writing with SwiftUI.
A 2048 game writing with SwiftUI.

2048 Game (SwiftUI app) This is a simple game to demonstrate the new SwiftUI framework. Note that the game algorithm may have issues, and this is stil

2D ECS game engine in 100% Swift + SwiftUI for iOS, macOS, tvOS
2D ECS game engine in 100% Swift + SwiftUI for iOS, macOS, tvOS

OctopusKit A 2D game engine based on ECS and written in 100% Swift for iOS, macOS and tvOS. If you've tried making a game in Swift while sticking to t

A Simple iOS Game App - Designed in SwiftUI 🚀

A Simple iOS Game App - Designed in SwiftUI 🚀 The game's aim is to make a cap to fill the color among them. On tapping any shapes, it will rotate 90

Owner
S
sing us a song, you're the piano man
S
A command line version of the popular Wordle game, written in Swift

WordleCLI A command line version of the popular game Wordle. For the original game, see: https://www.powerlanguage.co.uk/wordle/ Usage $ swift run Wel

Eneko Alonso 2 Jan 18, 2022
WordleAverage - Adds an Average Guesses statistic to the viral daily word game Wordle

WordleAverage Adds an "Average Guesses" statistic to the viral daily word game W

null 0 Jan 26, 2022
Wordle clone in SwiftUI for educational purposes

wordle-clone Wordle clone in SwiftUI for educational purposes. Word list copied

Erik Olsson 28 Oct 18, 2022
This is a clone project of Wordle. The app is made using SwiftUI

Wordle This is a clone project of Wordle. The app is made using SwiftUI. You can

HZ.Liu 5 Nov 25, 2022
Wordle Clone iOS app using Swift and SwiftUI 😎

Wordle Clone Wordle clone using Swift and SwiftUI for educational purposes. Video Preview Screenshots Features Hard Mode Help Screen Sync Stats across

Shameem Reza 8 Jan 1, 2023
Swift-WordleSolver - Solve and analyze Wordle games. Command-line tool written in Swift

Swift-WordleSolver - Solve and analyze Wordle games. Command-line tool written in Swift

Tobi Schweiger 0 Jan 26, 2022
Wordle Türkçe - iOS - Swift

Wordle-Turkce-iOS Xcode üzerinde derleyerek telefonunuza yükleyebilirsiniz ?? Günlük bir limit eklemedim istediğiniz kadar oynayabilirsiniz. Oyun sonu

Muhammed Faruk Söğüt 0 Feb 11, 2022
A little arcade game that uses SwiftUI as a game engine.

SwiftUI Game A little arcade game that uses SwiftUI as a game engine :) Just copy the code into the Blank playgroundbook in Swift Playgrounds app on i

Roman Gaditskiy 10 Sep 30, 2022
IOS Spin Game - A simple spin game using SwiftUI

IOS_Spin_Game A simple spin game using Swift UI.

Md. Masum Musfique 4 Mar 23, 2022
The one and only open source 4X MMO mid-core strategy game for iOS. Similar to Game of War and Mobile Strike

4X MMO Strategy Game for iOS I have spent 4 years of my life and a significant amount of money into completing this game and I hope you enjoy it. For

shankqr 69 Nov 16, 2022