{"id":21004669,"url":"https://github.com/flaque/sposure","last_synced_at":"2026-04-21T22:33:09.277Z","repository":{"id":80716162,"uuid":"70533839","full_name":"Flaque/Sposure","owner":"Flaque","description":"A portable exposure therapy game.","archived":false,"fork":false,"pushed_at":"2016-10-10T22:25:39.000Z","size":3410,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T10:13:49.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flaque.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-10T22:25:11.000Z","updated_at":"2024-01-20T08:42:10.000Z","dependencies_parsed_at":"2023-02-28T10:15:37.994Z","dependency_job_id":null,"html_url":"https://github.com/Flaque/Sposure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2FSposure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2FSposure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2FSposure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flaque%2FSposure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flaque","download_url":"https://codeload.github.com/Flaque/Sposure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243419461,"owners_count":20287894,"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","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":[],"created_at":"2024-11-19T08:37:25.827Z","updated_at":"2025-12-29T22:46:41.712Z","avatar_url":"https://github.com/Flaque.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sposure\nA portable exposure therapy game.\n\n![What we're going for](http://i.imgur.com/KwRhBx2.png)\n\n### Table of Contents\n1. A note on concurrency\n2. Documentation\n3. Vocabulary\n\n---\n\n# A note on concurrency\n\nUnderstanding concurrency in Swift is a big part of understanding this\nproject. It took me a bit to get it, but you're probably smarter than me\nso you'll probably pick it up fast. Either way, here's an overview of\neverything you need to know.\n\n### Grand Central Dispatch\nWant something to run on a different process in Swift? You need the GCD.\nThe GCD provides you will multiple different process queues that handle\neverything for you.\n\n\u003e The best way to think about GCD is like a list of jobs that you're adding\nto.\n\nWe use a cocoapod called [`GCDKit`](https://cocoapods.org/pods/GCDKit). GCDKit\ndoesn't add any extra functionality, but it makes the entire process easier\nvia syntactic sugar. It's a cleaner any prettier way to interact with the GCD.\n\n### Serial Queues\n\nIn `Serial` queues, processes happen one after the other.\n\n![Serial Queue](http://www.raywenderlich.com/wp-content/uploads/2014/09/Serial-Queue-Swift.png)\n\n### Concurrent Queues\nIn `Concurrent` queues, processes can happen at the same time.\n\n![Concurrent Queue](http://www.raywenderlich.com/wp-content/uploads/2014/09/Concurrent-Queue-Swift.png)\n\n\n### `.async` calls\nA `.async()` call means **the process returns immediately**.\n\nFor example:\n\n    var wasHit = false\n\n    myGCD.async() {\n      wasHit = true\n    }\n\n    print(wasHit)\n\nWill print out `false`.\n\n### `.sync` calls\n\nA `.sync()` call means **the process returns when it's finished**.\n\nFor example:\n\n    var wasHit = false\n\n    myGCD.sync() {\n      wasHit = true\n    }\n\n    print(wasHit)\n\nWill print out `true`.\n\n---\n\n# Documentation\nGood documentation means we know what modules are available and are more likely\nto use them. Docs allow us to write less code.\n\n## Gif Buffer\n\n_Behold the great doodle that started it all:_\n\n![Magic Image of drawing](http://i.imgur.com/gwWOLwR.jpg)\n\n### Overview\n\nThe Gif Buffer is made up of two pieces, each running on their own processes.\nThe first one is called the `GiphyManager` and the second one is called the\n`ImageManager`.\n\nThe basic flow is the following:\n-  The `GiphyManager` collects URLs (and other stuff) from Giphy.\n-  The `GiphyManager` enqueues those URLs into a queue data structure.\n-  The `ImageManager` dequeues from the queue and collects the image data from them.\n-  The `ImageManager` then enqueues them into another queue that stores all the gifs on the device.\n-  The `Main UI` listens for the end of the current gif in the stream and then pulls from the image queue when it's at the end.\n\nYET these processes are are all happening [AT THE SAME TIME](https://www.youtube.com/watch?v=bW7Op86ox9g).\n\n\n### `GiphyManager`\n\nThe `GiphyManager`'s job is to collect and return `Gif` objects.\n\nInside, there's a requestQueue of `GiphyRequest`s which gets\npopulated before anything happens. Each `GiphyRequest` is an\nobject that contains the `offset` and `limit` to be used in\neach Giphy request. [More info on Giphy's request system here.](https://github.com/Giphy/GiphyAPI#search-endpoint)\n\n#### GCDs\n\n- `managerGCD`  | serial | Manages the GiphyManager\n- `requestGCD`  | serial | Controls the requestQueue\n- `responseGCD` | serial | Controls the responseQueue\n\n### `ImageManager`\n\nThe `ImageManager`'s job is to pull `Gif` objects from the\n`GiphyManger`'s `responseQueue`. If it succeeds in doing this,\nit goes to the url and collects image data. Then it creates a\n`GifImage` which is an object that contains a `UIView` and\na `Gif`.\n\n#### GCDs\n\n- `managerGCD` | concurrent | Manages the ImageManager\n- `imageGCD`   | serial     | Controls the image Queue\n\n### `Searcher`\n\nHandles the communication with the `search` endpoint in giphy.\n\n`ping` - Gets the pagination data from  the search query.\n\n`search` - Actually performs a real search.\n\n### `Imager`\n\nHandles going to the url and collecting the data there.\n\n`findImage` - Goes to the URL, creates a `GifImage` and returns it.\n\n\n---\n\n# Vocabulary\nI have a bunch of bullshitty words that I've been using to describe parts of the\nsite. One of the things I've disliked when working on other projects is I never\nknew what any of the lingo meant. So this is basically a dictionary.\n\n#### `Gif Stream` or `Stream`\n\nThis is the part of the app where the user can hold down and see an endless\nstream of gifs.\n\n#### `GifBuffer`\n\nThe gif buffer is the part of the project that loads in URL's from Giphy\nand then goes to each one of those urls and downloads the image.\n\n#### `GCD`\n\nGCD stands for [Grand Central Dispatch](https://www.raywenderlich.com/79149/grand-central-dispatch-tutorial-swift-part-1) and I hate typing that out all the time.\nIt's synonymous with `process` and in general usage `thread`.\n\n** In code, it specifically refers to a GCD Queue. ** However, it's super\nimportant you don't actually call it just a queue. We also use a Queue\ndata structure and it gets _REAL CONFUSING REAL FAST GUYS OKAY_.\n\n#### `Resource Queue`\n\nIn our concurrency model, the resource queue is for passing data between\none module and another.\n\n#### `Game Over`\n\nThe screen after the gif stream where the user goes to see their score and\nhave the option of sharing their score with other folks in the internets.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fsposure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaque%2Fsposure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaque%2Fsposure/lists"}