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
#!/usr/bin/ruby | |
#Genious idea | |
#shamelessly copied from https://stackoverflow.com/questions/690151/getting-output-of-system-calls-in-ruby | |
def syscall(*cmd) | |
begin | |
stdout, stderr, status = Open3.capture3(*cmd) | |
status.success? && stdout.slice!(0..-(1 + $/.size)) # strip trailing eol | |
rescue | |
end |
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
#!/usr/bin/ruby | |
require 'open3' | |
require 'fileutils' | |
class ProtoConverter | |
@tag_to_be_checkout = nil | |
def initialize(tag_to_checkout) | |
@tag_to_be_checkout = tag_to_checkout | |
end |
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
let anyVehicleViewController: ViewControllerProtocol |
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
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let plane = PlaneViewController(with: PlaneViewModel()) | |
let car = CarViewController(with: CarViewModel()) | |
} | |
} |
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
class CarViewController: UIViewController, ViewControllerProtocol { | |
var viewModel: CarViewModel! | |
typealias viewModelType = CarViewModel | |
} | |
class PlaneViewController: UIViewController, ViewControllerProtocol { | |
var viewModel: PlaneViewModel! | |
typealias viewModelType = PlaneViewModel | |
} |
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 ViewControllerProtocol: UIViewController { | |
associatedtype viewModelType | |
var viewModel: viewModelType! { get set } | |
init(with viewModel: viewModelType) | |
} | |
extension ViewControllerProtocol { | |
init(with viewModel: viewModelType) { | |
self.init(nibName: nil, bundle: 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
private let viewModel:CarViewModel | |
required init(with viewModel: CarViewModel) { | |
self.viewModel = viewModel | |
super.init(nibName: nil, bundle: 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
class CarViewController: UIViewController { | |
private let viewModel:CarViewModel | |
required init(with viewModel: CarViewModel) { | |
self.viewModel = viewModel | |
super.init(nibName: nil, bundle: nil) | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") |
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
class ViewControllerV2: UIViewController { | |
var passedClass: Description! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
debugPrint(passedClass.discribe()) | |
} | |
} |
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
var passedClass: Description! |