Code Monkey home page Code Monkey logo

dr.light's Introduction


Introduction

中文详解 the name of Dr.Light is inspird by Dr.Strange, it is a very simple,light kit to avoid crash in some cases.

range of protection

  • fresh ui in nonmain thread.

  • add/remove KVO unpaired

  • pushing viewcontrollers frequently within a short perid.
    for example,add push code in viewDidLoad,before viewDidAppear has called,it is dangerous.It may caused crash cannot addsubView:self.

    pushing the same viewcontroller into one stack.

  • send unrecognized selector

Installation

CocoaPods

pod 'DrLight'

Manual

import the files you needed into your project.

Useage

ui thread-safety

just include UIView+ViewCrashSafety.h、UIView+ViewCrashSafety.m in your project.

kvo safety

include UIView+ViewCrashSafety.hUIView+ViewCrashSafety.m in your project,then import the header.

#import "NSObject+KVOCrashSafety.h"

start protection for the KVO logic you coded.

school = [[School alloc] init];
school.schoolName = @"First school";
school.kvoSafteyToggle = YES;
    
[school addObserver:self forKeyPath:@"schoolName" options:NSKeyValueObservingOptionNew context:nil];

navigation safety

include UINavigationController+NestedPushCrashSafety.hUINavigationController+NestedPushCrashSafety.m in your project. set the limit of time interval between pushing viewcontroller,defaut is 0.1.

self.navigationController.navStackChangeInterval = 0.1;

unrecognized selector safety

include NSObject+SelectorCrashSafety.hNSObject+SelectorCrashSafety.m in your project.

Note

the safaty toggle closed by default in debug mode in order to discover crash problems in the development phase. If you are eager to turn on the protection in debug mode, please comment out this line of code #define DRLIGHT_TOGGLE_CLOSED.

Contact

I'll add more features in a later release,you can contact me [email protected].

License

DrLight is released under a BSD License. See LICENSE file for details.

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.