Giter Site home page Giter Site logo

jujuforce / deallocationchecker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fastred/deallocationchecker

0.0 1.0 0.0 662 KB

Catch leaking view controllers without opening Instruments.

Home Page: http://holko.pl/2017/06/26/checking-uiviewcontroller-deallocation/

License: MIT License

Ruby 5.98% Swift 86.90% C 0.74% Objective-C 6.38%

deallocationchecker's Introduction

DeallocationChecker

Learn about leaking view controllers without opening Instruments.

Build Status

Usage

First, enable the library by calling (for example from your application delegate):

#if DEBUG
    DeallocationChecker.shared.setup(with: .alert) // There are other options than .alert too!
#endif

Then, in your view controllers from within viewDidDisappear(_:) override, call:

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)

    DeallocationChecker.shared.checkDeallocation(of: self)
}

If a view controller isn’t deallocated after disappearing for good, you'll see a helpful alert:

Leaked view controller demo

At this point we can simply open the Memory Graph Debugger to investigate the reason of a cycle.

Installation

CocoaPods

Add the line pod "DeallocationChecker" to your Podfile

Carthage

Add the line github "fastred/DeallocationChecker" to your Cartfile

Author

Project created by Arek Holko (@arekholko on Twitter).

deallocationchecker's People

Contributors

fastred avatar ben-g avatar jujuforce avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.