Giter Site home page Giter Site logo

chenyilong / cyldeallocblockexecutor Goto Github PK

View Code? Open in Web Editor NEW
254.0 254.0 41.0 22.33 MB

Hello block,byebye dealloc!一行代码代替dealloc完成“self-manager”

Home Page: http://weibo.com/luohanchenyilong/

License: MIT License

Objective-C 97.28% Ruby 2.72%

cyldeallocblockexecutor's Introduction

ChenYilong 👋

😄 I'm @ChenYilong, living in Auckland, New Zealand, and a programmer who knows a bit about Objective-C, Swift, and Java and has written apps and frameworks.
👯 I'm currently writing some Swift, flutter, and Java code in my spare time at iTeaTime(源码派). Welcome to join the group.
📫 If you want to chat, you can send me an email, direct Twitter DM, and other ways to contact me.
📺 Welcome to fellow my YouTube channel: @iTeaTime Tech | 技术清谈

cyldeallocblockexecutor's People

Contributors

chenyilong avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cyldeallocblockexecutor's Issues

一个应用场景

在ios11+里面,vc是先removefromsuperview再销毁控制器的。在ios11+里面,vc是先removefromsuperview再销毁控制器的。

其实不是引用的问题,是释放顺序的问题

对同一个对象调用 cyl_executeAtDealloc:

在代码不同的地方,对同一个对象调用 [xxx cyl_executeAtDealloc:^{....}]。 期望是所有传入的block在对象释放时都可以执行。 这样能达到吗? 现在的使用情况是,设置新的block时,前一个block得到了调用,这时对象并没有释放, 这时如果在里面做了removeObserver等操作时就会有潜在bug。而对象dealloc时只调用了最后一个block.

这似乎是一个问题

        //因为用到了dispatch_barrier_async,该函数只能搭配自定义并行队列dispatch_queue_t使用。所以不能使用:dispatch_get_global_queue
        queue = dispatch_queue_create(queueName, DISPATCH_QUEUE_SERIAL);

创建的是一个串行队列。。。

Swfit实现

用法

vc.addObserver(view)
vc.view.addsubview(view)

view.deinit {
 view.removeObserver)(
}

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.