QuizGame: an iOS application that offers quizes

Overview

Quiz Game

QuizGame is an iOS application that offers quizes.

Application Features

  • It is a simple iOS app built by Swift, which presents a quick quiz, marks the answers, and shows the result to participants.
  • Data is not yet stored in CoreData.
  • Animation is to be used later on to make the app interface more friendly.
  • A progress bar is shown to the participant to indicate their progress.

Code Samples

@IBAction func trueButton(_ sender: Any) {
        
        if quizArray[qNo].qAnswer == true {
            progressView.progress = progressBar()
            score += 1
            self.trueButton.backgroundColor = UIColor.green
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                self.trueButton.backgroundColor = UIColor.systemTeal
            }
            qNo += 1
            if qNo < 10{
                qNoLabel.text = "السؤال\(qNo + 1): "
                questionTextView.text = quizArray[qNo].qString
            }else{
                showResultMessage()
            }
        }else {
            progressView.progress = progressBar()
            questionTextView.text = quizArray[qNo].qString
            self.trueButton.backgroundColor = UIColor.red
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                self.trueButton.backgroundColor = UIColor.systemTeal
            }
            qNo += 1
            if qNo<10{
                qNoLabel.text = "السؤال\(qNo + 1): "
                questionTextView.text = quizArray[qNo].qString
            }else{
                showResultMessage()
            }
        }
    }
    
    @IBAction func falseButton(_ sender: Any) {
        if quizArray[qNo].qAnswer == false {
            progressView.progress = progressBar()
            score += 1
            self.falseButton.backgroundColor = UIColor.green
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                self.falseButton.backgroundColor = UIColor.systemTeal
            }
            qNo += 1
            if qNo < 10{
                qNoLabel.text = "السؤال\(qNo + 1): "
                questionTextView.text = quizArray[qNo].qString
            }else{
                showResultMessage()
            }
        }else {
            progressView.progress = progressBar()
            questionTextView.text = quizArray[qNo].qString
            self.falseButton.backgroundColor = UIColor.red
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                self.falseButton.backgroundColor = UIColor.systemTeal
            }
            qNo += 1
            if qNo<10{
                qNoLabel.text = "السؤال\(qNo + 1): "
                questionTextView.text = quizArray[qNo].qString
            }else{
                showResultMessage()
            }
        }
    }
    
    
    func progressBar() -> Float{
        return Float (qNo + 1) / Float(quizArray.count)
    }
    
    func showResultMessage(){
        let alert = UIAlertController(title: "Quiz Result", message: "Your score is: \(score)/10", preferredStyle: UIAlertController.Style.alert)
        let closeAction = UIAlertAction(title: "OK", style: UIAlertAction.Style.default) { _ in self.navigationController?.popViewController(animated: true)
        }
        alert.addAction(closeAction)
        self.present(alert, animated: true, completion: nil)
    }

Demos


demo2.mp4
You might also like...
Basispay IOS SDK Version 2

BasisPay-IOS-KIT BasisPay IOS Payment Gateway kit for developers INTRODUCTION This document describes the steps for integrating Basispay online paymen

Release repo for Gini Bank SDK for iOS
Release repo for Gini Bank SDK for iOS

Gini Bank SDK for iOS The Gini Bank SDK provides components for capturing, reviewing and analyzing photos of invoices and remittance slips. By integra

Da Xue Zhang Platform Lvb iOS SDK

Cloud_Lvb_SDK iOS API Reference Dxz Meeting iOS SDK是为 iOS 平台用户音视频服务的开源 SDK。通过大学长开放平台自研RTC,RTM系统,为客户提供质量可靠的音视频服务。 类 类名 描述 CLS_PlatformManager SDK的音视频主要

PayPal iOS SDK

PayPal iOS SDK Welcome to PayPal's iOS SDK. This library will help you accept card, PayPal, Venmo, and alternative payment methods in your iOS app. Su

Unofficial Notion API SDK for iOS & macOS
Unofficial Notion API SDK for iOS & macOS

NotionSwift Unofficial Notion SDK for iOS & macOS. This is still work in progress version, the module interface might change. API Documentation This l

150,000+ stickers API & SDK for iOS Apps.
150,000+ stickers API & SDK for iOS Apps.

English | 한국어 Stipop UI SDK for iOS Stipop SDK provides over 150,000 .png and .gif stickers that can be easily integrated into mobile app chats, comme

Spotify SDK for iOS
Spotify SDK for iOS

Spotify iOS SDK Overview The Spotify iOS framework allows your application to interact with the Spotify app running in the background on a user's devi

Used to integrate the Facebook Platform with your iOS & tvOS apps.

Facebook SDK for iOS This open-source library allows you to integrate Facebook into your iOS app. Learn more about the provided samples, documentation

Accept credit cards and PayPal in your iOS app
Accept credit cards and PayPal in your iOS app

Important: PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themse

Owner
Alharbi
Alharbi
This repository is for the iOS sample application using ARGear SDK.

ARGear sample application for iOS (c) Copyright 2021 Seerslab. All rights reserved. This repository contains an iOS sample application that uses ARGea

ARGear 2 Apr 5, 2022
An Application to list the products and on selection of product list the detail of particular product

Merchandising An Application to list the products and on selection of product list the detail of particular product This application uses VIPER design

Poonam Yadav 0 Nov 28, 2021
JustTrivia - Trivia Application Created in Swift

JustTrivia - Trivia Application Created in Swift Usage Please use a small number

null 0 Dec 30, 2021
Business-API - Business App an Application that show list business using the Yelp API

business-API Business App an Application that show list business using the Yelp

Edwin Niwarlangga 0 Jan 21, 2022
Project Flat iOS is the iOS client of Agora Flat open source classroom.

Agora Flat iOS Project flat is the iOS client of Agora Flat open source classroom. 中文 Features Open sourced front-end and back-end [Flat Web][flat-web

netless 24 Dec 12, 2022
Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK

RadarCOVID iOS App Introduction Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK Prerequisites These are the tools used to bu

Radar COVID 146 Nov 24, 2022
The official CovPass(-Check) iOS apps

CovPass / CovPass Check Einfach. Sicher. Papierlos. Mit der CovPass-App können Bürgerinnen und Bürger ihre Corona-Impfungen direkt auf das Smartphone

null 96 Dec 18, 2022
TelegramStickersImport — Telegram stickers importing SDK for iOS

TelegramStickersImport — Telegram stickers importing SDK for iOS TelegramStickersImport helps your users import third-party programaticaly created sti

null 35 Oct 26, 2022
Native iOS port of KDE Connect

Welcome to KDE Connect iOS 2021's Testing Repository! This project is inteded to be the iOS version of the group of applications called KDE Connect, w

KDE GitHub Mirror 292 Dec 27, 2022
Muxer used on top of Feed iOS SDK for airplay

FeedAirplayMuxer Muxer used on top of Feed iOS SDK for airplay purposes. Demo Project --> https://github.com/feedfm/AirplayDemo Feed Airplay Muxer is

Feed Media 0 May 6, 2022