Skip to content

Instantly share code, notes, and snippets.

View Morbix's full-sized avatar

Henrique Morbin Morbix

  • iFood
  • Porto, Portugal
  • 03:25 (UTC +01:00)
View GitHub Profile
if hash tailor 2>/dev/null; then
tailor --except=trailing-whitespace,todo-syntax "${PROJECT_NAME}"
else
echo "warning: Please install Tailor from https://tailor.sh"
fi
import XCTest
extension XCTestCase {
func waitForKeyboard() {
expectationForPredicate(Predicate.countEqual1, evaluatedWithObject: XCUIApplication().keyboards, handler: nil)
waitForExpectationsWithTimeout(10, handler: nil)
}
func waitForElementExist(element: XCUIElement, timeout: NSTimeInterval = 10) {
let attributedString = NSMutableAttributedString(string: "")
let attrs = [
NSFontAttributeName: UIFont(name: font, size: size)!,
NSForegroundColorAttributeName: UIColor.whiteColor()]
let attributedText = NSMutableAttributedString(string: label, attributes: attrs)
attributedString.appendAttributedString(attributedText)
textField.attributedPlaceholder = attributedString
if [ $CONFIGURATION == Release ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
# increment the build number (ie 115 to 116)
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
@Morbix
Morbix / AppDelegate.swift
Created October 16, 2016 14:19
Defining initial controller without storyboard
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = UINavigationController(rootViewController: PetsViewController())
window?.makeKeyAndVisible()
return true
}
@Morbix
Morbix / .swiftlint.yml
Created October 19, 2016 22:10
swift lint yml example
disabled_rules:
- trailing_whitespace
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- R.generated.swift
line_length:
- 170
- 200
@Morbix
Morbix / gist:3a986c97737cb05518306bf54b7f2459
Last active August 1, 2022 08:15
[Xcode] Ignore all warnings in a specific file
Xcode > Project > Target > Build Phases > Compile Sources > Compiler Flags: -w
Source: http://stackoverflow.com/questions/6921884/in-xcode-how-to-suppress-all-warnings-in-specific-source-files
@Morbix
Morbix / gist:41a2b835f05ea79407a88ce1b18ff76d
Created December 13, 2016 22:37
[iOS] Call Swift function inside Objective-C class
1. Add #import "MyFirstProjectOnSwift-Swift.h" in "MyObjectiveCLass.m"
2. Add @class mySwiftClass in MyObjectiveCLass.h;
3. Then in MyObjectiveCLass.m
mySwiftClass *myClass = [mySwiftClass new]; {Call Like This in any method wherever you want to call swift method.}
4. [myClass methodName];
Source: http://stackoverflow.com/questions/24078043/call-swift-function-from-objective-c-class
func recursiveDescription(view: UIView, count: Int) {
let subviews = view.subviews
if subviews.count == 0 {
return
}
var tabs = ""
for i in 0..<count {
tabs = tabs+"...."