{"id":20533998,"url":"https://github.com/nzrsky/odweakify","last_synced_at":"2026-04-20T13:06:18.262Z","repository":{"id":56921150,"uuid":"61159720","full_name":"nzrsky/ODWeakify","owner":"nzrsky","description":"Fancy header-only weakifying and strongifying for Objective-C 💪 ","archived":true,"fork":false,"pushed_at":"2022-10-22T12:12:24.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T08:02:01.736Z","etag":null,"topics":["cocoa","cocoapods","ios","macos","objc","objective-c","osx","weak"],"latest_commit_sha":null,"homepage":"","language":"C","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/nzrsky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-14T22:24:43.000Z","updated_at":"2025-02-01T11:48:05.000Z","dependencies_parsed_at":"2022-08-20T21:50:27.503Z","dependency_job_id":null,"html_url":"https://github.com/nzrsky/ODWeakify","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/nzrsky/ODWeakify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzrsky%2FODWeakify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzrsky%2FODWeakify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzrsky%2FODWeakify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzrsky%2FODWeakify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nzrsky","download_url":"https://codeload.github.com/nzrsky/ODWeakify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzrsky%2FODWeakify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264958623,"owners_count":23689035,"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":["cocoa","cocoapods","ios","macos","objc","objective-c","osx","weak"],"created_at":"2024-11-16T00:24:46.412Z","updated_at":"2026-04-20T13:06:18.216Z","avatar_url":"https://github.com/nzrsky.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ODWeakify\n\n[![Build Status](https://app.travis-ci.com/nzrsky/ODWeakify.svg?branch=master)](https://app.travis-ci.com/nzrsky/ODWeakify)\n[![codecov.io](https://codecov.io/github/nzrsky/ODWeakify/coverage.svg?branch=master)](https://codecov.io/github/nzrsky/ODWeakify?branch=master)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ODWeakify.svg)](https://cocoapods.org/pods/ODWeakify)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/ODWeakify.svg?style=flat)](http://cocoadocs.org/docsets/ODWeakify)\n[![Twitter](https://img.shields.io/badge/twitter-@nzrsky-blue.svg?style=flat)](http://twitter.com/nzrsky)\n\n\n## Usage\n\nDo you often write smthng like this in ObjC?\n```objective-c\n__weak __typeof(self) weakSelf = self;\nself.completionHandler = ^{\n    __typeof(self) strongSelf = weakSelf;\n    [strongSelf doSomething];\n\n    // or just use weakSelf\n    weakSelf.var = nil;\n    \n    // some other code\n    self.property = @\"foo\";\n};\n```\n\nIt looks horrible. And, did you notice, we forgot to use weakSelf when set foo. \nIt's really often mistake. So, with ODWeakify you can do it easier:\n\n```objective-c\n// #import \u003cODWeakify.h\u003e\n\nod_weakify(self);\nself.completionHandler = ^{\n    od_strongify(self);\n    [self doSomething];\n\n    self_weak_.var = nil; // We can still use weak if we need it \n    self.property = @\"foo\";  \n};\n\n```\nNow all `self`s inside block will be in safe from retain cycles. \nAnd if you forget strongify (and won't use self_weak_) you'll get a warning. \n\n## Installation\nODWeakify supports multiple methods for installing the library in a project.\n\n## Installation with CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C and Swift, which automates and simplifies the process of using 3rd-party libraries like ODWeakify in your projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n#### Podfile\n\nTo integrate ODWeakify into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\ntarget 'TargetName' do\npod 'ODWeakify'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Installation with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate ODWeakify into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Rogaven/ODWeakify\" ~\u003e 1.1\n```\n\nRun `carthage` to build the framework and drag the built `ODWeakify.framework` into your Xcode project.\n\n\n## Author\n\nAlexey Nazarov, alexx.nazaroff@gmail.com\n\n## License\n\nODWeakify is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzrsky%2Fodweakify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnzrsky%2Fodweakify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzrsky%2Fodweakify/lists"}