Skip to content

Instantly share code, notes, and snippets.

View Morbix's full-sized avatar

Henrique Morbin Morbix

  • iFood
  • Porto, Portugal
  • 01:47 (UTC +01:00)
View GitHub Profile
public class Main {
public static void main(String[] args) {
Veiculo f1 = new CarroF1();
f1.acelera(10);
f1.acelera(10);
f1.freia(50);
@Morbix
Morbix / gist:408251ddcdbf442dc99dcfc481123bfd
Created October 3, 2018 12:48
Não deixar o app abrir a cena se estiver rodando os testes unitários.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if ProcessInfo().environment["XCInjectBundleInto"] != nil { return true }
...
}
protocol CloudTagViewDelegate {
func cloud(_ cloud: CloudTagView, tagTouched tag: TagView)
func cloud(_ cloud: CloudTagView, tagDismissed tag: TagView)
}
@Morbix
Morbix / gist:69bb6320e971bfe3e6d2d8e7b4669ab1
Created July 26, 2017 12:22
Link to get kml from Google Maps
http://www.google.com/maps/d/u/0/kml?forcekml=1&mid=14eieZr331zbNk2zfPIWdT4fHY_c
let frameworkBundle = Bundle(for: IniciaisImageView.self)
guard let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("AgiplanUtils.bundle") else { return }
let resourceBundle = Bundle(url: bundleURL)
guard let view = resourceBundle?.loadNibNamed("IniciaisImageView", owner: self, options: nil)?.first as? UIView else {
return
}
open -a Atom ~/.gitconfig
@Morbix
Morbix / gist:cc8807d21a383d639143acf9cf580138
Created June 28, 2017 12:52
UITextField with multiple lines
extension UITextField {
// Works only if the UITextField don't have the focus and have some text,
// so prefer call this in the didEndEditing event.
func setNumberOfLines(_ numberOfLines: Int, lineBreakMode: NSLineBreakMode) {
self.subviews.forEach { subview in
guard let label = subview as? UILabel else { return }
label.lineBreakMode = lineBreakMode
label.numberOfLines = numberOfLines
}
func recursiveDescription(view: UIView, count: Int) {
let subviews = view.subviews
if subviews.count == 0 {
return
}
var tabs = ""
for i in 0..<count {
tabs = tabs+"...."
@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
@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