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
import UIKit | |
import Forbind | |
import ForbindExtensions | |
enum LoadingState { | |
case NotSet | |
case Loading | |
case Loaded | |
} |
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
import UIKit | |
class GenericView: UIView { | |
let stackView = UIStackView() | |
init() { | |
super.init(frame: CGRectZero) | |
setup() | |
} | |
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
import UIKit | |
class GenericViewController: UIViewController { | |
var contentView: GenericView { | |
return view as! GenericView | |
} | |
init() { | |
super.init(nibName: nil, bundle: nil) |
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
class MyAwesomeViewConroller: UIViewController { | |
var awesomeView: MyAwesomeView { | |
return view as MyAwesomeView | |
} | |
init() { | |
super.init(nibName: nil, bundle: nil) | |
} | |
override func loadView() { |
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 View: UIView { | |
public init() { | |
super.init(frame: CGRect.zero) | |
configureView() | |
} | |
public required init?(coder: NSCoder) { | |
super.init(coder: coder) | |
configureView() | |
} |
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
@objc func didPressLogIn(sender: AnyObject?) { | |
guard !isPerformingLogIn else { return } | |
isPerformingLogIn = true | |
let email = contentView.formView.emailField.text | |
let password = contentView.formView.passwordField.text | |
guard validateAndShowError(email, password: password) else { | |
isPerformingLogIn = false | |
return |
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
class AwesomeView: GenericView { | |
let bestTitleLabel = UILabel().then { | |
$0.textAlignment = .Center | |
$0.textColor = .purpleColor()tww | |
} | |
let otherTitleLabel = UILabel().then { | |
$0.textAlignment = . | |
$0.textColor = .greenColor() | |
} |
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
class AwesomeView: GenericView { | |
let bestTitleLabel: UILabel = { | |
let label = UILabel() | |
label.textAlignment = .Center | |
label.textColor = .purpleColor() | |
return label | |
}() | |
let otherTitleLabel: UILabel = { |
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
currentRequest?.getValue { [weak self] result in | |
guard let user = result.okValue where result.errorValue == nil else { | |
self?.showRequestError(result.errorValue) | |
self?.isPerformingSignUp = false | |
return | |
} | |
self?.finishSignUp(user) | |
} |
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
ImageView img = (ImageView)findViewById(R.id.imgView1); | |
img.setImageResource(android.R.drawable.ic_media_play); |