{"id":1848,"url":"https://github.com/surfstudio/CoreEvents","last_synced_at":"2025-08-02T05:32:49.571Z","repository":{"id":55444856,"uuid":"129365688","full_name":"surfstudio/CoreEvents","owner":"surfstudio","description":"Small swift events kit","archived":false,"fork":false,"pushed_at":"2022-05-25T08:40:14.000Z","size":97,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-07-05T11:17:13.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/surfstudio.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-04-13T07:29:47.000Z","updated_at":"2022-05-25T08:34:50.000Z","dependencies_parsed_at":"2022-08-15T00:30:24.614Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/CoreEvents","commit_stats":null,"previous_names":["lastsprint/eventskit"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/surfstudio/CoreEvents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2FCoreEvents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2FCoreEvents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2FCoreEvents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2FCoreEvents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/CoreEvents/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2FCoreEvents/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339403,"owners_count":24234544,"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-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-01-05T20:15:57.231Z","updated_at":"2025-08-02T05:32:49.183Z","avatar_url":"https://github.com/surfstudio.png","language":"Swift","funding_links":[],"categories":["Reactive Programming"],"sub_categories":["React-Like"],"readme":"[![Build Status](https://travis-ci.org/surfstudio/CoreEvents.svg?branch=master)](https://travis-ci.org/surfstudio/CoreEvents)\n[![codebeat badge](https://codebeat.co/badges/4ced5e8d-8d44-4111-81df-0fb2012cbbb1)](https://codebeat.co/projects/github-com-surfstudio-coreevents-master)\n[![codecov](https://codecov.io/gh/surfstudio/CoreEvents/branch/master/graph/badge.svg)](https://codecov.io/gh/surfstudio/CoreEvents/branch/master/graph/badge.svg)\n\n# CoreEvents\nSmall Swift events kit that provides some base types of events:\n- [`FutureEvent`](#futureevent)\n- [`PresentEvent`](#presentevent)\n- [`PastEvent`](#pastevent)\n\n## FutureEvent\n\nSimple event. \nProvides classic behaviour.\n\n### Description\n\nThis is classic event (like C# `event`) that can contain many listeners and multicast each new message for this listeners.\nThis event emits **only** new messages. It means if you add a new listener to existed event then last will not emit previous messages to the new listener.\n\n### Types\n- `FutureEvent: Event`\n\n### Example\n\n```swift\nvar event = FutureEvent\u003cInt\u003e()\n\nevent += { value in\n  print(\"Awesome int: \\(value)\")\n}\n\nevent.invoke(with: 42)\n\n```\n\nwill print `Awesome int: 42`\n\n## PresentEvent\n\n### Description\n\nThis event provides all `Future` logic, but additionally provides emiting last emited value for a new listener.\nIt means if your event already emits value and you add a new listener then your listener handles previous emited value in the same time.\n\n### Types\n- `PresentEvent: Event`\n\n### Example\n\n```swift\nvar event = PresentEvent\u003cInt\u003e()\n\nevent += { value in\n  print(\"Awesome int: \\(value)\")\n}\n\nevent.invoke(with: 42)\n\nevent += {\n    print(\"Old awesome int: \\(value)\")\n}\n\n```\n\nwill print:\n\n`Awesome int: 42`\n\n`Old awesome int: 42`\n\n## PastEvent\n\n### Description\n\nThis event is like the Present, but emits all previous messages for a new listener\n\n### Types\n\n- `PastEvent: Event`\n\n### Example\n\n```swift\nvar event = PastEvent\u003cInt\u003e()\n\nevent.invoke(with: 0)\nevent.invoke(with: 1)\n\nevent += { value in\n  print(\"Awesome int: \\(value)\")\n}\n\nevent.invoke(with: 2)\n\n```\n\nWill print:\n\n`Awesome int: 0`\n\n`Awesome int: 1`\n \n`Awesome int: 2`\n\n## How to install\n\n`pod 'CoreEvents', '~\u003e 2.0.1'`\n\nWe also support SPM: \n\n`.package(url: \"https://github.com/surfstudio/CoreEvents\", .exact(\"2.0.2\"))`\n\n## Warning \n\nIn one file you can not use just `add`, you should specify a key - `add(key: String, _ listener: Closure)`\n\n## Versioning\n\nVersion format is `x.y.z` where\n- x is major version number. Bumped only in major updates (implementaion changes, adding new functionality)\n- y is minor version number. Bumped only in minor updates (interface changes)\n- z is minor version number. Bumped in case of bug fixes and e.t.c.\n\n## Author\n\n[Kravchenkov Alexander](https://github.com/LastSprint)\n\n[MIT License](https://github.com/surfstudio/CoreEvents/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2FCoreEvents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2FCoreEvents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2FCoreEvents/lists"}