{"id":32109219,"url":"https://github.com/ivlevastef/swiftlazy","last_synced_at":"2026-02-27T11:26:49.785Z","repository":{"id":62456559,"uuid":"128607555","full_name":"ivlevAstef/SwiftLazy","owner":"ivlevAstef","description":"Classes (Lazy, Provider) is intended for late initialization.","archived":false,"fork":false,"pushed_at":"2024-12-25T08:03:13.000Z","size":49,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-20T12:58:39.054Z","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/ivlevAstef.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-08T06:38:19.000Z","updated_at":"2025-07-09T21:13:56.000Z","dependencies_parsed_at":"2024-12-25T07:30:00.630Z","dependency_job_id":"04899f14-52fd-40d7-aee0-ac54c8ef8a79","html_url":"https://github.com/ivlevAstef/SwiftLazy","commit_stats":{"total_commits":27,"total_committers":6,"mean_commits":4.5,"dds":0.7037037037037037,"last_synced_commit":"8a6b79b5295516459aff0404a517c7f47badae3f"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/ivlevAstef/SwiftLazy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FSwiftLazy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FSwiftLazy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FSwiftLazy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FSwiftLazy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivlevAstef","download_url":"https://codeload.github.com/ivlevAstef/SwiftLazy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FSwiftLazy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280094904,"owners_count":26271003,"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-10-20T02:00:06.978Z","response_time":62,"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":"2025-10-20T12:58:48.195Z","updated_at":"2025-10-20T12:58:49.209Z","avatar_url":"https://github.com/ivlevAstef.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CocoaPods Version](https://img.shields.io/cocoapods/v/SwiftLazy.svg?style=flat)](http://cocoapods.org/pods/SwiftLazy)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/github/license/ivlevAstef/SwiftLazy.svg?maxAge=2592000)](http://cocoapods.org/pods/SwiftLazy)\n[![Swift Version](https://img.shields.io/badge/Swift-3.0--5.8-F16D39.svg?style=flat)](https://developer.apple.com/swift)\n[![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-lightgrey.svg)](http://cocoapods.org/pods/SwiftLazy)\n\n# SwiftLazy\nSwift allows for lazy variables out-of-the-box, however they're fairly restricted.\n\n## Features\n* Lazy and Provider operations\n* Short syntax\n* Thread safe\n\n## Usage\n\n### Lazy\n\n```Swift\nlet lazyInt = Lazy(1)\nprint(lazyInt.wasMade)  // false\nprint(lazyInt.value) // 1\nprint(lazyInt.wasMade)  // true\n```\n\nSupport arithmetic operations:\n```Swift\nlet lazyInt = Lazy\u003cInt\u003e{ 1 + 2 * 5 } * 4 + 10\nprint(lazyInt.wasMade)  // false\nprint(lazyInt.value) // 54\nprint(lazyInt.wasMade)  // true\n```\n\nShort syntax:\n```Swift\nlet lazyInt = Lazy(1)\nprint(*lazyInt) // 1\n```\n\n### Provider\n\n```Swift\nlet providerInt = Provider(1)\nprint(lazyInt.value) // 1\n```\n\nSupport arithmetic operations:\n```Swift\nlet providerInt = Provider\u003cInt\u003e{ 1 + 2 * 5 } * 4 + 10\nprint(providerInt.value) // 54\n```\n\nShort syntax:\n```Swift\nlet providerInt = Provider(1)\nprint(*providerInt) // 1\n```\n\n### Difference Lazy vs Provider\n\n```Swift\nvar counter: Int = 0\nlet lazyInt = Lazy\u003cInt\u003e {\n  counter += 1\n  return counter\n}\n\nprint(lazyInt.value) // 1\nprint(lazyInt.value) // 1\nprint(lazyInt.value) // 1\n\nlazyInt.clear() // no provider\nprint(lazyInt.value) // 2\nprint(lazyInt.value) // 2\nprint(lazyInt.value) // 2\n```\n\n```Swift\nvar counter: Int = 0\nlet providerInt = Provider\u003cInt\u003e {\ncounter += 1\nreturn counter\n}\n\nprint(providerInt.value) // 1\nprint(providerInt.value) // 2\nprint(providerInt.value) // 3\n```\n\n### Version 1.1.0\n\nAdd Provider with arguments:\n```Swift\nlet provider = Provider2\u003cString, Int, Double\u003e { \"\\($0) + \\($1) = \\($0 + $1)\" }\n\nprint(provider.value(10, 20.0)) // \"10 + 20.0 = 30.0\"\n```\nSupport 1, 2, 3, 4, 5 arguments count.\n\n## Install\n###### Via CocoaPods.\n\nTo install SwiftLazy with CocoaPods, add the following lines to your Podfile: `pod 'SwiftLazy'`\n\n###### Via Carthage.\ngithub \"ivlevAstef/SwiftLazy\" \n\n### The library is integrated with DITranquillity\n\n## Requirements\niOS 11.0+,macOS 10.13+,tvOS 11.0+, watchOS 4.0+, Linux; ARC\n\n## Feedback\n\n### I've found a bug, or have a feature request\nPlease raise a [GitHub issue](https://github.com/ivlevAstef/SwiftLazy/issues).\n\n### Question?\nYou can feel free to ask the question at e-mail: ivlev.stef@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivlevastef%2Fswiftlazy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivlevastef%2Fswiftlazy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivlevastef%2Fswiftlazy/lists"}