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

๐ŸŒˆ Pride Trivia & Alan Turing Edition

An iOS trivia game built with SwiftUI celebrating Pride Month and the legacy of Alan Turing, the father of modern computing.

Demo Video โ†’

What it is

A 10-question multiple choice trivia quiz covering LGBTQIA+ history and Alan Turing's life and contributions to computer science. Questions are shuffled into a random order each time you play, with instant feedback and a fun fact after every answer.

Features

  • 10 trivia questions on Pride history and Alan Turing's legacy
  • Rainbow themed UI with a deep purple background and gradient accents
  • Shuffled question order every game
  • Instant feedback โ€” green for correct, red for wrong
  • Fun fact shown after every answer
  • Live score tracking with a rainbow progress bar
  • Results screen with a personalised message based on your score
  • Play Again and Share Score buttons
  • Alan Turing quote on the results screen

How to run

โ€ฆ

๐Ÿ› ๏ธ 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 (3)

Collapse
 
technogamerz profile image
๐•‹๐•™๐•– ๐•ƒ๐•’๐•ซ๐•ช ๐”พ๐•š๐•ฃ๐•

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

Collapse
 
gamya_m profile image
Gamya

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

Some comments may only be visible to logged-in visitors. Sign in to view all comments.