-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mvvm #14
base: svastven
Are you sure you want to change the base?
Mvvm #14
Conversation
vendulasvastal
commented
Mar 23, 2019
- logika ve View Modelech
- propojení View Modelů s View Controllery
- oddělení Views od View Controllerů
- logika Flow Controlleru
for progress hud and navigation bar
launch function is still in process
|
||
override func bindViewToViewModel(v: UIView, vm: AppViewModel) { | ||
let balanceView = v as! BalanceView | ||
let vm = vm as! BalanceViewModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tyjo asi chápu o co tady jde, ale tohle by chtělo vyřešit nějak jinak. Jednak to není zrovna safe a jednak sis vlastně neušetřila moc žádnou práci.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jako cela ta overridnuta funkce, je nesmysl, nebo to castovani?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No pojďme diskutovat nejdřív o tom, proč ta overriden funkce..? Nebo jako proč je overriden chápu, ale proč existuje v tom baseVC v té obecné podobě? Co tím sleduješ? Co to přináší za výhodu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overriden protoze ji volam ve view did load a kdyby bylo view controlleru vice, tak bych delala v kazdem to same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noooo a teď děláš v každém to samé (cast na konkrétní view a VM) a navíc s vykřičníkama 😛 Nápad chápu, ale nepřijde mi, že bys tím něco vyhrála.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
co takhle?
class BaseVC<T> {
init(vm: T) {
bind(to: vm)
}
func bind(to: T) {
print("base print: \(to)")
}
}
class SomeVC: BaseVC<Int> {
override func bind(to: Int) {
print("int print: \(to)")
}
}
let foo = SomeVC(vm: 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
joo, to vypada moc dobre 👍
return resultRequestBalancePage.map { [weak self] in | ||
guard let strongSelf = self, let balancePage = $0.element, $0.info == .loggedIn else { | ||
SVProgressHUD.showError(withStatus: "Failed".localized) | ||
SVProgressHUD.dismiss(withDelay: 1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ten progress hud z VM není moc good. Když ti teď řeknu ať to vyměníš za nějaký custom view, tak jseš nahraná. Loading indicator je UI, tedy z těch písmenek MVVM je to to View, tak ho nedávej do VM 😏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jasne, makes sense, ja prave vahala jak to s tim udelat :D fixnu
import UIKit | ||
|
||
extension UIImage { | ||
enum ImageId: String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Znáš SwiftGen? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
znam, dam ho tam
jak to s tebou vypadá? :) |
mela jsem jeste ted moc honku, ale opet na to zase koukam |
Chceš na tom ještě pracovat? 😄 už je to dost velký, ale klidně to zase rozhýbu 🙂 |