DEV Community

Gamya
Gamya

Posted on

๐ŸŒˆ Pride Trivia & Alan Turing Edition โ€” A SwiftUI Game for June Solstice Game Jam

June Solstice Game Jam Submission

Hey DEV community! ๐Ÿ‘‹ I'm Gamya, an iOS developer and new here on DEV. So excited to be part of my first ever Game Jam! ๐ŸŒˆ Hope you enjoy it! ๐Ÿš€

๐ŸŒˆ What I Built

Pride Trivia & Alan Turing Edition is an iOS trivia game built entirely with SwiftUI that celebrates two incredibly important themes this June:

  • ๐Ÿณ๏ธโ€๐ŸŒˆ Pride Month โ€” honouring LGBTQIA+ history, identity, and resilience
  • ๐Ÿ’ป Alan Turing โ€” the father of modern computing, who was tragically prosecuted for being gay in 1952

The game challenges players with 10 multiple choice questions covering Pride history and Alan Turing's extraordinary legacy โ€” with fun facts after every answer so you walk away having learned something new every time you play.


๐ŸŽฎ Demo Video

https://youtube.com/shorts/cuF7QwYrt50?feature=share

๐Ÿ“น Please see the demo video attached to this submission showing the full game flow from welcome screen through to results.


โœจ Features

  • ๐ŸŒˆ Rainbow themed UI โ€” deep purple background with full rainbow gradient accents throughout
  • ๐Ÿ“ฑ 10 trivia questions covering Pride history and Alan Turing's life and legacy
  • ๐Ÿ”€ Shuffled questions โ€” different order every time you play
  • โœ… Instant feedback โ€” green for correct, red for wrong
  • ๐Ÿ’ก Fun facts after every answer โ€” so every wrong answer is a learning moment
  • ๐Ÿ“Š Live score tracking in gold with rainbow progress bar
  • ๐Ÿ† Results screen with personalised message based on your score
  • ๐Ÿ” Play Again button to restart instantly
  • ๐Ÿ“ค Share Score button to share your results
  • ๐Ÿ’ฌ Alan Turing quote on the results screen โ€” a tribute to his incredible mind

๐ŸŽฏ Connection to the June Theme

June is a month of profound meaning:

Pride Month celebrates LGBTQIA+ identity, history, and the ongoing fight for equality. The Stonewall Riots of 1969, the first Pride marches of 1970, the rainbow flag designed by Gilbert Baker in 1978 โ€” this history deserves to be known and celebrated.

Alan Turing was born in June 1912. He was the genius who cracked the Enigma Code during World War II โ€” work that is estimated to have shortened the war by two to four years and saved millions of lives. He also laid the foundations of modern computer science. And yet he was prosecuted by the British government for being gay and chemically castrated as punishment. He died in 1954 at just 41 years old.

Every smartphone, every computer, every app โ€” including this one โ€” exists in part because of Alan Turing. Building a game that celebrates both his intellectual legacy and his identity felt like exactly the right tribute for June. ๐Ÿณ๏ธโ€๐ŸŒˆ๐Ÿ’ป


๐Ÿ› ๏ธ How I Built It

The game is built entirely with SwiftUI for iOS and structured across five Swift files:

๐Ÿ“ Project Structure

PrideTriviaGame/
โ”œโ”€โ”€ TriviaData.swift      โ€” Question model and all 10 questions
โ”œโ”€โ”€ WelcomeView.swift     โ€” Welcome screen with rainbow UI
โ”œโ”€โ”€ QuestionView.swift    โ€” Question screen with answer logic
โ”œโ”€โ”€ ResultView.swift      โ€” Results screen with score breakdown
โ””โ”€โ”€ ContentView.swift     โ€” App entry point, controls screen flow
Enter fullscreen mode Exit fullscreen mode

๐Ÿง  Key Technical Concepts Used

Structs and Data Modeling

Each question is modeled as a Swift struct:

struct TriviaQuestion {
    let question: String
    let answers: [String]
    let correctIndex: Int
    let funFact: String
}
Enter fullscreen mode Exit fullscreen mode

State Management with SwiftUI

The app uses @State and @Binding to manage game flow between screens:

@State private var gameStarted = false
@State private var gameFinished = false
@State private var score = 0
Enter fullscreen mode Exit fullscreen mode

Dynamic UI with ForEach

Answer buttons are generated dynamically from the question data:

ForEach(0..<currentQuestion.answers.count, id: \.self) { index in
    Button { } label: { }
}
Enter fullscreen mode Exit fullscreen mode

Rainbow Progress Bar with GeometryReader

GeometryReader { geo in
    RoundedRectangle(cornerRadius: 5)
        .fill(LinearGradient(
            colors: [.red, .orange, .yellow, .green, .blue, .purple],
            startPoint: .leading,
            endPoint: .trailing
        ))
        .frame(width: geo.size.width * CGFloat(currentIndex + 1) / CGFloat(questions.count))
}
Enter fullscreen mode Exit fullscreen mode

Shuffled Questions

let triviaQuestions: [TriviaQuestion] = [ ... ].shuffled()
Enter fullscreen mode Exit fullscreen mode

One line makes the question order random every single game! ๐ŸŽฒ

Score Based Result Messages

var resultMessage: (emoji: String, title: String, message: String) {
    switch percentage {
    case 90...100: return ("๐Ÿ†", "Outstanding!", "...")
    case 70...89:  return ("๐ŸŒˆ", "Excellent!", "...")
    case 50...69:  return ("โญ", "Well Done!", "...")
    default:       return ("๐ŸŒฑ", "Keep Learning!", "...")
    }
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”— Source Code

GitHub: github.com/gamya-hub/PrideTriviaGame


๐Ÿ’ญ What I Learned

Building this game taught me so much โ€” not just about SwiftUI but about the history I was writing questions about. Learning about Alan Turing's story while building an app that literally runs on the foundations he created was a deeply meaningful experience.

The June Solstice is a moment of transition โ€” from one season to the next. In the same way, Pride Month and Alan Turing's legacy remind us how far we've come and how much further we still need to go. This game is a small tribute to that journey. ๐ŸŒˆ


๐Ÿณ๏ธโ€๐ŸŒˆ Happy Pride Month!

"We can only see a short distance ahead, but we can see plenty there that needs to be done."
โ€” Alan Turing

Top comments (2)

Collapse
 
technogamerz profile image
The Lazy Girl (โ โ—•โ แด—โ โ—•โ โœฟโ )

Thanks for posting ๐Ÿ˜Š(โ โ—•โ แด—โ โ—•โ โœฟโ )

Collapse
 
gamya_m profile image
Gamya

Thank you so much! ๐ŸŒธ Really happy to finally have it out there.