This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (instancetype)sharedInstance { | |
static dispatch_once_t once; | |
static NSMutableDictionary *sharedInstances; | |
dispatch_once(&once, ^{ | |
// Creating of the container for shared instances for different classes | |
sharedInstances = [NSMutableDictionary new]; | |
}); | |
id sharedInstance = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/ | |
# Adapted to work with the official image available into Mac App Store | |
# | |
# Enjoy! | |
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app | |
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J | |
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
included: | |
- {Project folder} | |
- {Project test folder} | |
excluded: | |
- {Project folder}/Extensions/UIImage+Assets.swift # automatically generated file | |
opt_in_rules: | |
- closure_spacing # closure should have single space inside each brace | |
- empty_count # prefer isEmpty over comparing to 0 | |
- number_separator # underscore should be used as thousand separator in large decimal numbers | |
disabled_rules: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableView *)parentTableView { | |
// iterate up the view hierarchy to find the table containing this cell/view | |
UIView *aView = self.superview; | |
while(aView != nil) { | |
if([aView isKindOfClass:[UITableView class]]) { | |
return (UITableView *)aView; | |
} | |
aView = aView.superview; | |
} | |
return nil; // this view is not within a tableView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLayoutSubviews { | |
[super viewDidLayoutSubviews]; | |
// Give system time to properly recalculate tableHeaderView height and update it | |
// Otherwise wrong height appear on iOS 10 | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
self.tableView.tableHeaderView = self.tableView.tableHeaderView; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CustomStringConvertible { | |
var description : String { | |
var description: String = "" | |
if self is AnyObject { | |
description = "***** \(self.dynamicType) - <\(unsafeAddressOf((self as! AnyObject)))>***** \n" | |
} else { | |
description = "***** \(self.dynamicType) *****\n" | |
} | |
let selfMirror = Mirror(reflecting: self) | |
for child in selfMirror.children { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f ~/.bash_profile ]; then | |
source ~/.bash_profile | |
fi | |
hash oclint &> /dev/null | |
if [ $? -eq 1 ]; then | |
echo >&2 "oclint not found, analyzing stopped" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol NibLoadable { } | |
extension NibLoadable where Self: UIView { | |
static var nibName: String { | |
return String(describing: self) | |
} | |
} | |
extension UITableViewCell: NibLoadable { } | |
protocol Reusable { } | |
extension Reusable where Self: UIView { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAGS="TODO:|FIXME:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script: | |
if which swiftgen >/dev/null; then | |
swiftgen images ${SCRIPT_INPUT_FILE_0} --output ${SCRIPT_OUTPUT_FILE_0} | |
else | |
echo "SwiftGen does not exist, download from https://github.com/AliSoftware/SwiftGen" | |
fi | |
Input: | |
$(SRCROOT)/{Project Name}/Assets.xcassets |