Skip to content

Instantly share code, notes, and snippets.

Avatar

Bohdan Orlov BohdanOrlov

View GitHub Profile
View totalLinesOfCode.sh
find . \( -iname Pods -prune \) -o \( -iname \*.m -o -iname \*.mm -o -iname \*.h -o -iname \*.swift \) -print | sed -e 's/"/"\\""/g' -e 's/.*/"&"/' | xargs wc -l | awk '/total/{k+=$1}END{print k,"total"}'
@BohdanOrlov
BohdanOrlov / ViewControllerLifecycleBehavior.swift
Created Oct 23, 2017
Swift implementation of idea that manny view controller can do light work: http://khanlou.com/2016/02/many-controllers/
View ViewControllerLifecycleBehavior.swift
public protocol ViewControllerLifecycleBehavior {
func afterLoading(_ viewController: UIViewController)
func beforeAppearing(_ viewController: UIViewController)
func afterAppearing(_ viewController: UIViewController)
func beforeDisappearing(_ viewController: UIViewController)
func afterDisappearing(_ viewController: UIViewController)
@BohdanOrlov
BohdanOrlov / contacts.m
Created Jul 15, 2016
Generate contacts with uk phone numbers
View contacts.m
@import AddressBook;
- (void)removeContactWithName:(NSString *)name {
NSString *searchName = name;
ABAddressBookRef addressbook = ABAddressBookCreate();
CFStringRef nameRef = (__bridge CFStringRef) searchName;
CFArrayRef allSearchRecords = ABAddressBookCopyPeopleWithName(addressbook, nameRef);
[self removeContactWithRecordsList:allSearchRecords];
}
You can’t perform that action at this time.