Build a Trivia Game application from scratch in SwiftUI
In this tutorial, we'll start from the basic Hello World screen, all the way to building a beautiful and functional trivia game application. Once built, you'll have endless hours of fun playing this trivia game!
🔗 Links mentioned in the video:
➡ OpenTrivia API Helper: https://opentdb.com/api_config.php
➡ Learn more about AttributedString: https://designcode.io/swiftui-handbook-markdown-attributed-string
➡ OpenTrivia API endpoint we're calling: https://opentdb.com/api.php?amount=10
✏️ Watch without ads, and access the written version and source files:
➡ Part 1: https://designcode.io/quick-apps-swiftui-trivia-app-1
➡ Part 2: https://designcode.io/quick-apps-swiftui-trivia-app-2
➡ Part 3: https://designcode.io/quick-apps-swiftui-trivia-app-3
➡ Part 4: https://designcode.io/quick-apps-swiftui-trivia-app-4
👩🏻💻 Source code on Github:
➡ https://github.com/stephdiep/TriviaGameApp
🪄 Join our channel and unlock members-only perks:
➡ https://www.youtube.com/channel/UCTIhfOopxukTIRkbXJ3kN-g/join
👋🏻 Let's connect!
➡ Twitter: https://twitter.com/diepsteph
🎞 Video timestamps
➡ Part 1 - Create project and code welcome screen
0:00 - Introduction
2:07 - OpenTrivia API
2:47 - Create the Xcode project
4:18 - Set accent color
5:41 - Welcome screen
➡ Part 2 - Code QuestionView
11:19 - Code the QuestionView
17:21 - Answer model and AnswerRow component
24:53 - Finish the QuestionView
26:31 - Navigate to QuestionView
➡ Part 3 - Trivia model and TriviaManager
28:54 - Create the Trivia model
36:20 - Create the TriviaManager
41:22 - Go to next question function
42:52 - Set next question function
46:48 - Select and answer function
➡ Part 4: Connect to UI and play the game!
47:40 - Connect TriviaManager to UI
49:56 - Update the AnswerRow
51:35 - Update the QuestionView
55:22 - Update the TriviaView
58:25 - Reset states in TriviaManager
59:09 - Play the trivia!
1:00 - Conclusion
#triviagame #swiftui #tutorial