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! πŸš€

This is a submission for the June Solstice Game Jam


🌈 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.

Connection to June Theme:

June is a month of profound meaning. Pride Month celebrates LGBTQIA+ identity and history. Alan Turing was born in June 1912 β€” the genius who cracked the Enigma Code during World War II, saving millions of lives, yet was prosecuted by the British government for being gay. 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. πŸ³οΈβ€πŸŒˆπŸ’»

Features:

  • 🌈 Rainbow themed UI with deep purple background and full rainbow gradient accents
  • 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
  • πŸ“Š Live score tracking with rainbow progress bar
  • πŸ† Results screen with personalised message based on your score
  • πŸ” Play Again button to restart instantly
  • πŸ“€ Share Score button
  • πŸ’¬ Alan Turing quote on the results screen

πŸŽ₯ Video Demo


πŸ’» Code

GitHub logo gamya-hub / PrideTriviaGame

A Pride & Alan Turning themed trivia game built with swiftUI

PrideTriviaGame

A Pride & Alan Turning themed trivia game built with swiftUI





πŸ› οΈ 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 Decisions

Structs for Data Modeling

Each question is modeled as a Swift struct with four properties β€” the question text, an array of four possible answers, the index of the correct answer, and a fun fact to show after answering:

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

State Management

The entire app flow is controlled by just three @State variables in ContentView:

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

SwiftUI automatically updates the UI whenever these change β€” no manual screen switching needed.

Shuffled Questions

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

One line makes the question order random every single game!

Rainbow Progress Bar

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

Score Based Results

var resultMessage: (emoji: String, title: String, message: String) {
    switch percentage {
    case 90...100: return ("πŸ†", "Outstanding!", "You're a Pride and Alan Turing expert!")
    case 70...89:  return ("🌈", "Excellent!", "You have brilliant knowledge of LGBTQIA+ history!")
    case 50...69:  return ("⭐", "Well Done!", "Good effort! There's always more to learn.")
    default:       return ("🌱", "Keep Learning!", "Every question is a chance to learn something new!")
    }
}
Enter fullscreen mode Exit fullscreen mode

πŸ† Prize Category

Best Ode to Alan Turing

This entire game is dedicated to Alan Turing. Here's how:

  • The quiz content β€” multiple questions specifically about Alan Turing's life, his work cracking the Enigma Code at Bletchley Park, the Turing Test, and his tragic prosecution for being gay
  • The dedication β€” the welcome screen reads "Dedicated to Alan Turing (1912-1954)"
  • The closing quote β€” the results screen features his famous quote: "We can only see a short distance ahead, but we can see plenty there that needs to be done."
  • The theme β€” connecting Turing's identity as a gay man to Pride Month creates a meaningful bridge between his computing legacy and his human story

Alan Turing was the father of modern computing and a gay man persecuted by his own government. This game exists to make sure people know both parts of his story. πŸ’»πŸ³οΈβ€πŸŒˆ


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

🌈 Happy Pride Month!

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.