Latest 1.1.4
License MIT
Platforms ios 5.0, osx 10.6, watchos 1.0, tvos 9.0, requires ARC
Dependencies ODStringify
Frameworks Foundation

Build Status
CocoaPods Compatible
Carthage compatible


Do you often write smthng like this in ObjC?

__weak __typeof(self) weakSelf = self;
self.completionHandler = ^{
    __typeof(self) strongSelf = weakSelf;
    [strongSelf doSomething];

    // or just use weakSelf
    weakSelf.var = nil;

    // some other code = @"foo";

It looks horrible. And, did you notice, we forgot to use weakSelf when set foo.
It’s really often mistake. So, with ODWeakify you can do it easier:

// #import <ODWeakify.h>

self.completionHandler = ^{
    [self doSomething];

    self_weak_.var = nil; // We can still use weak if we need it = @"foo";  

Now all selfs inside block will be in safe from retain cycles.
And if you forget strongify (and won’t use selfweak) you’ll get a warning.


ODWeakify supports multiple methods for installing the library in a project.

Installation with CocoaPods

CocoaPods 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:

$ gem install cocoapods


To integrate ODWeakify into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '8.0'

target 'TargetName' do
pod 'ODWeakify'

Then, run the following command:

$ pod install

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ODWeakify into your Xcode project using Carthage, specify it in your Cartfile:

github "Rogaven/ODWeakify" ~> 1.1

Run carthage to build the framework and drag the built ODWeakify.framework into your Xcode project.


Alexey Nazaroff, [email protected]


ODWeakify is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "ODWeakify",
    "version": "1.1.4",
    "summary": "Weakify and strongify wrappers for ObjC",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    "authors": {
        "Alexey Nazaroff": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.4"
    "social_media_url": "",
    "platforms": {
        "ios": "5.0",
        "osx": "10.6",
        "watchos": "1.0",
        "tvos": "9.0"
    "requires_arc": true,
    "frameworks": "Foundation",
    "source_files": "src/**/*",
    "public_header_files": "src/include/**/*",
    "dependencies": {
        "ODStringify": []
    "prefix_header_contents": "#ifndef TARGET_OS_IOSn  #define TARGET_OS_IOS TARGET_OS_IPHONEn#endifn#ifndef TARGET_OS_WATCHn  #define TARGET_OS_WATCH 0n#endifn#ifndef TARGET_OS_TVn  #define TARGET_OS_TV 0n#endif"

Pin It on Pinterest

Share This