{"id":20464815,"url":"https://github.com/steve228uk/quizkit","last_synced_at":"2025-07-31T00:41:09.868Z","repository":{"id":56921566,"uuid":"125060684","full_name":"steve228uk/QuizKit","owner":"steve228uk","description":"⁉️ A framework for developing local or remote quiz apps for iOS or tvOS","archived":false,"fork":false,"pushed_at":"2018-03-23T10:43:26.000Z","size":101,"stargazers_count":28,"open_issues_count":0,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-14T23:58:54.316Z","etag":null,"topics":["cocoapod","cocoapods","game","ios","json","quiz","swift","tvos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steve228uk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-13T14:02:09.000Z","updated_at":"2023-07-11T15:26:34.000Z","dependencies_parsed_at":"2022-08-20T21:50:30.984Z","dependency_job_id":null,"html_url":"https://github.com/steve228uk/QuizKit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/steve228uk/QuizKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steve228uk%2FQuizKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steve228uk%2FQuizKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steve228uk%2FQuizKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steve228uk%2FQuizKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steve228uk","download_url":"https://codeload.github.com/steve228uk/QuizKit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steve228uk%2FQuizKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267967720,"owners_count":24173566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapod","cocoapods","game","ios","json","quiz","swift","tvos"],"created_at":"2024-11-15T13:16:33.942Z","updated_at":"2025-07-31T00:41:09.794Z","avatar_url":"https://github.com/steve228uk.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"readme-resources/logo.png\" style=\"max-height: 150px;\" alt=\"QuizKit for iOS and tvOS\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License: MIT\"\u003e\n    \u003c/a\u003e \u003ca href=\"https://cocoapods.org/pods/QuizKit\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/QuizKit.svg\" alt=\"CocoaPods\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## About\n\nQuizKit was built to enable rapid development of local or remote quiz apps. It allows for quizzes to be constructed from JSON and supports multiple question types. It handles randomisation of questions, sessions, and scoring.\n\nIt works great on iOS and tvOS.\n\nUI is not currently included but an example application will be made available soon and I'm open to including drop-in view controllers in the future.\n\n## Docs\n\nThere are three core classes/structs that are visible to you when using QuizKit:\n\n- `QKQuiz` - This is the quiz that has been loaded from JSON. Its sole purpose is to be loaded into a `QKSession`. You may wish to build an app with multiple quizzes which could be separate JSON files or loaded from a JSON string fetched from a remote server.\n- `QKSession` - This is the main class that you will interact with. There is a shared instance that is accessible from `QKSession.default`. A quiz is loaded into the session, questions are retreived from here, and responses submitted.\n- `QKQuestion` - Individual questions are wrapped in this model. It houses information such as the question, type (using `QKQuestionType`), image, and responses.\n\n### Question types\n\nQuizKit currently supports the following question types, definted on `QKQuestionType`:\n\n- `singleAnswer` - This is an open ended question that would be perfect for a text box.\n- `multipleChoice` - Used for questions with multiple text responses.\n- `imageChoice` - Similar to `multipleChoice` but the choices are instead image based instead of text.\n\n### Loading a quiz and starting a session\n\nThere are two initialisers for loading a quiz that work in the same way. The first you can pass the path to a JSON file included locally in your app and the second takes a JSON string directly.\n\nThe below example is how you would load a quiz on a `UIViewController` from a JSON file. \n\n```swift\nimport QuizKit\n\nclass ExampleViewController: UIViewController {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        loadQuiz()\n    }\n\n    func loadQuiz() {\n        guard let path = Bundle.main.path(forResource: \"quiz\", ofType: \"json\") else {\n            return\n        }\n        \n        QKSession.default.limit = 10\n        \n        if let quiz = QKQuiz(loadFromJSONFile: path) {\n            QKSession.default.load(quiz: quiz)\n        }\n    }\n    \n    @IBAction func startQuiz(_ sender: Any) {\n        do {\n            try QKSession.default.start()\n        } catch {\n            fatalError(\"Quiz started without quiz set on the session\")\n        }\n        \n        if let question = QKSession.default.nextQuestion() {\n            // SHOW THE QUESTION VIEW HERE\n        }\n    }\n    \n}\n```\n\nThe `startQuiz` method in this example has been wired up to a button in interface builder. When the user taps the button a new session is started.\n\nThe `QKSession.default.nextQuestion()` method accepts an optional question in order to return the next correctly. A `QKQuestion` or `nil` is returned dependent on whether its the last question in the session.\n\nThere is currently one option `QKSession.default.limit` to set the number of questions in a session.\n\n### Submitting a response\n\nEntering a response to a question is done via the `QKSession.default.submit(response: String, for: QKQuestion)` method. The first parameter is the response the user has given as a string (for an image choice question submit the URL of the image). The second parameter is the `QKQuestion` instance the user is responding to.\n\n```swift\nQKSession.default.submit(response: \"User Response Here\", for: question)\n```\n\n### Retreiving the score\n\nWhen the user has finished the quiz a score can be obtained from `QKSession`.\n\nAn integer value of the number of questions the user got correct is available as well as a string formatted like `7 / 10`.\n\n```swift\nlet integerScore = QKSession.default.score\nlet stringScore = QKSession.default.formattedScore\n```\n\nIndividual results for each question are also accessible should you wish to display to the user which questions they got right or wrong.\n\n```swift\nlet individualResults = QKSession.default.responses\n```\n\n### Examples\n\nAn [example JSON file is available here](readme-resources/example-quiz.json).\n\nAn example app will be available soon.\n\n## Installation\n\n### Manual\n\nQuizKit currently relies on [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON) to parse the JSON files and strings. If you wish to install QuizKit in your project manually you'll need to also include SwiftyJSON as well as the `Sources` directory from this repository.\n\n### CocoaPods\n\nCocoaPods is an easier way to install QuizKit and its dependencies. Simply include the following in your project's `Podfile`.\n\n```ruby\npod 'QuizKit'\n```\n\n## Todo\n\n- [ ] Potentially implement JSON parsing in-project to avoid SwiftyJSON dependency.\n- [ ] Add additional initialisers for quizzes such as CSV or Plist.\n- [ ] Add example application.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteve228uk%2Fquizkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteve228uk%2Fquizkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteve228uk%2Fquizkit/lists"}