the name of Dr.Light is inspird by Dr.Strange, it is a very simple,light kit to avoid crash in some cases.
-
fresh ui in nonmain thread.
-
add/remove KVO unpaired
-
pushing viewcontrollers frequently within a short perid.
for example,add push code inviewDidLoad
,beforeviewDidAppear
has called,it is dangerous.It may caused crashcannot addsubView:self
.pushing the same viewcontroller into one stack.
just include UIView+ViewCrashSafety.h、UIView+ViewCrashSafety.m in your project.
include UIView+ViewCrashSafety.h
、UIView+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];
include UINavigationController+NestedPushCrashSafety.h
、UINavigationController+NestedPushCrashSafety.m
in your project.
set the limit of time interval between pushing viewcontroller,defaut is 0.1.
self.navigationController.navStackChangeInterval = 0.1;
I'll add more features in a later release,you can contact me zanyfly@126.com.
KVOController is released under a BSD License. See LICENSE file for details.