{"id":13489484,"url":"https://github.com/tailec/CombineExamples","last_synced_at":"2025-03-28T04:31:12.507Z","repository":{"id":44403412,"uuid":"192914667","full_name":"tailec/CombineExamples","owner":"tailec","description":"Getting started with Apple Combine","archived":false,"fork":false,"pushed_at":"2022-09-10T13:33:43.000Z","size":533,"stargazers_count":167,"open_issues_count":0,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-01-25T03:16:04.512Z","etag":null,"topics":["combine","reactive","reactive-programming","swift"],"latest_commit_sha":null,"homepage":null,"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/tailec.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}},"created_at":"2019-06-20T12:17:59.000Z","updated_at":"2023-12-13T19:43:39.000Z","dependencies_parsed_at":"2023-01-18T03:00:14.724Z","dependency_job_id":null,"html_url":"https://github.com/tailec/CombineExamples","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/tailec%2FCombineExamples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailec%2FCombineExamples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailec%2FCombineExamples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailec%2FCombineExamples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailec","download_url":"https://codeload.github.com/tailec/CombineExamples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245970556,"owners_count":20702441,"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":["combine","reactive","reactive-programming","swift"],"created_at":"2024-07-31T19:00:28.801Z","updated_at":"2025-03-28T04:31:12.169Z","avatar_url":"https://github.com/tailec.png","language":"Swift","funding_links":[],"categories":["Open Source"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCombineExamples\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eWIP\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n👷 🧱 🧰 🛠️\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\u003cstrong\u003eGetting started with Combine\u003c/strong\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n A collection of simple examples using Apple Combine reactive framework\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003c!-- Last commit --\u003e\n\u003cimg src=\"https://img.shields.io/github/last-commit/tailec/CombineExamples.svg\" alt=\"last commit\"/\u003e\n\u003c!-- Open issues --\u003e\n\u003cimg src=\"https://img.shields.io/github/issues-raw/tailec/CombineExamples.svg\" alt=\"open issues\" /\u003e\n\u003c!-- Swift version --\u003e\n\u003cimg src=\"https://img.shields.io/badge/swift%20version-5.1-brightgreen.svg\" alt=\"swift version\"\u003e\n\u003c!-- Platform --\u003e\n\u003cimg src=\"https://img.shields.io/badge/platform-ios-lightgrey.svg\" alt=\"platform\" /\u003e\n\u003c!-- License --\u003e\n\u003cimg src=\"https://img.shields.io/badge/licence%20-MIT%20-blue.svg\" alt=\"license\" /\u003e\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\u003csub\u003eBuilt with ❤︎ by\nPawel Krawiec\n\u003c/sub\u003e\n\u003c/div\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\n## Examples\n\n\n\u003cimg align=\"left\" src=\"https://github.com/tailec/CombineExamples/blob/master/Resources/LoginGif.gif\" /\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/tailec/CombineExamples/tree/master/CombineExamples/Login\"\u003e\u003ch1 align=\"left\"\u003eLOGIN SCREEN\u003c/h1\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch4\u003eSimple user login validation\u003c/h4\u003e\n\n```swift\nlet credentials = Publishers\n    .CombineLatest($username, $password) { ($0, $1) }\n    .share()\ncredentials\n    .map { uname, pass in\n        uname.count \u003e= 4 \u0026\u0026 pass.count \u003e= 4\n    }\n    .prepend(false) // initial state\n    .assign(to: \\.isEnabled, on: loginButton)\n    .cancelled(by: cancellableBag)\n    // More in the example...\n```\n\n\u003cbr\u003e\u003c/br\u003e\n\n\n\u003cimg align=\"left\" src=\"https://github.com/tailec/CombineExamples/blob/master/Resources/TimerGif.gif\" /\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/tailec/CombineExamples/tree/master/CombineExamples/Timer\"\u003e\u003ch1 align=\"left\"\u003eTIMER\u003c/h1\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch4\u003eSimplified stopwatch\u003c/h4\u003e\n\n```swift\nTimer.publish(every: 0.1, on: .main, in: .default)\n    .autoconnect()\n    .scan(0, { (acc, _ ) in return acc + 1 })\n    .map { $0.timeInterval }\n    .replaceError(with: \"\")\n    .eraseToAnyPublisher()\n    .assign(to: \\.currentTime, on: self)\n    .cancelled(by: cancellableBag)\n    // More in the example...\n```\n\n\u003cbr\u003e\u003c/br\u003e\n\n\n\u003cimg align=\"left\" src=\"https://github.com/tailec/CombineExamples/blob/master/Resources/SearchGif.gif\" /\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/tailec/CombineExamples/tree/master/CombineExamples/Search\"\u003e\u003ch1 align=\"left\"\u003eSEARCH\u003c/h1\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch4\u003eBrowsing GitHub repositories\u003c/h4\u003e\n\n```swift\n$query\n    .throttle(for: 0.5, \n        scheduler: .main, \n           latest: true)\n    .removeDuplicates()\n    .map { query in\n        return API().search(with: query)\n            .retry(3)\n            .eraseToAnyPublisher()\n    }\n    // More in the example...\n```\n\n\u003cbr\u003e\u003c/br\u003e\n\n\n\u003cimg align=\"left\" src=\"https://github.com/tailec/CombineExamples/blob/master/Resources/UsernameGif.gif\" /\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/tailec/CombineExamples/tree/master/CombineExamples/Username\"\u003e\u003ch1 align=\"left\"\u003eAVAILABILITY\u003c/h1\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch4\u003eCheck if your repository name is already taken\u003c/h4\u003e\n\n```swift\n $text\n    .throttle(for: 0.5, scheduler: .main, latest: true)\n    .map { text in\n        API().search(with: text)\n            .map { isAvailable in\n                isAvailable ? \"Name available\" : \"Name already taken\"\n            }\n            .prepend(\"Checking...\")\n    }\n    .switchToLatest()\n    // More in the example...\n```\n\n\u003cbr\u003e\u003c/br\u003e\n\n\n\u003ch3\u003eStay tuned. More examples coming.\u003c/h3\u003e\n\n\n## Licence\nMIT.\n\nThe Apple logo and the Combine framework are property of Apple Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailec%2FCombineExamples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailec%2FCombineExamples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailec%2FCombineExamples/lists"}