This file contains 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
public class MyViewController: UIViewController { | |
var viewModel: MyViewModel? { | |
willSet(maybeViewModel) { | |
if let _ = self.viewModel { | |
unbindViewModel() | |
} | |
} | |
didSet { | |
if isViewLoaded(), let viewModel = self.viewModel { |
This file contains 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
public protocol ViewModelBindable: class { | |
typealias ViewModel | |
var viewModel: ViewModel? { get set } | |
func bindViewModel(viewModel: ViewModel) | |
func unbindViewModel(viewModel: ViewModel) |
This file contains 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 ViewModelBindable where Self: AnyObject { | |
public var viewModel: ViewModel? { | |
// store view model | |
} | |
} |
This file contains 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 ViewModelBindable where Self: AnyObject { | |
public var viewModel: ViewModel? { | |
get { | |
return getAssociatedObject(self, key: &AssociatedKey) | |
} | |
set(newViewModel) { | |
if let viewModel = newViewModel { |
This file contains 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
public final class MyViewController: UIViewController { | |
// Your implementation | |
} | |
extension MyViewController: ViewModelBindable { | |
public func bindViewModel(viewModel: MyViewModel) { | |
// binding logic | |
} |
This file contains 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 var AssociatedKey: UInt = 1 | |
private final class AssociatedObjectBox<T> { | |
let value: T | |
init(_ x: T) { | |
value = x | |
} | |
} |
This file contains 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 var AssociatedKey: UInt = 0 | |
private final class AssociatedObjectBox<T> { | |
let value: T | |
init(_ x: T) { | |
value = x | |
} | |
} |
This file contains 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 UIView { | |
private var previousHeightConstraint: NSLayoutConstraint? { | |
return constraints.filterFirst { $0.firstAttribute == .Height } | |
} | |
} | |
/** | |
Collapse a view by adding/modifying constraint height. |
This file contains 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
# https://labs.kunstmaan.be/blog/ios-continuous-delivery-with-jenkins-and-fastlane?this-one-is-for-you-roderik | |
# Define the minimal Fastlane version | |
# fastlane_version "1.41.1" | |
# Use the iOS platform as default | |
default_platform :ios | |
# Define what to do for the iOS platform | |
platform :ios do |
This file contains 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
input { | |
syslog { | |
host => localhost | |
port => 5000 | |
} | |
} | |
filter { | |
} |
OlderNewer