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
git checkout develop | |
git merge --squash feature/... | |
git commit -am '#issue comment' | |
git push origin develop | |
git branch -D feature/... | |
git push origin :feature/... | |
In result flow like: | |
* <1234567> 2016-05-06 [dev1] (HEAD, origin/develop, develop) version bump | |
| * <1234567> 2016-05-06 [dev1] (tag: 1.52, master, origin/master) Merge branch 'develop' |
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
import UIKit | |
private weak var _currentFirstResponder: UIResponder? = nil | |
extension UIResponder { | |
class func mwb_firstResponder() -> UIResponder? { | |
_currentFirstResponder = nil | |
// If you trying send action to nil, it will automatically called on first responder | |
UIApplication.shared.sendAction(#selector(mwb_findFirstResponder), to: nil, from: nil, for: nil) | |
return _currentFirstResponder |
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 String { | |
func toEnum<Enum: RawRepresentable where Enum.RawValue == String>() -> Enum? { | |
return Enum(rawValue: self) | |
} | |
} | |
enum Segue: String { | |
case Foo | |
case Bar | |
} |
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
1. Symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints. | |
2. Add debug command: | |
- ObjC: po [[UIWindow keyWindow] _autolayoutTrace] | |
- Swift: expr -l objc++ -O -- [[UIWindow keyWindow] _autolayoutTrace] | |
3. Colorfy bad views: | |
expr ((UIView *)0x7f9ea3d43410).backgroundColor = [UIColor redColor] |
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 |
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
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
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
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
- (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; | |
}); | |
} |
OlderNewer