-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,568 additions
and
228 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// ItemCell.swift | ||
// iOStarter | ||
// | ||
// Created by Macintosh on 05/04/22. | ||
// Copyright © 2022 WahyuAdyP. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ItemCell: UICollectionViewCell { | ||
@IBOutlet weak var imageView: UIImageView! | ||
@IBOutlet weak var nameLbl: UILabel! | ||
@IBOutlet weak var detailLbl: UILabel! | ||
|
||
var viewModel: ItemVM! { | ||
didSet { | ||
imageView.kf.setImage(with: viewModel.imageUrl) | ||
nameLbl.text = viewModel.name | ||
detailLbl.text = viewModel.detail | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// GridVC.swift | ||
// iOStarter | ||
// | ||
// Created by Macintosh on 05/04/22. | ||
// Copyright © 2022 WahyuAdyP. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class GridVC: CollectionViewController { | ||
let viewModel = ListVM() | ||
|
||
override func fetch(isLoadMore: Bool = false) { | ||
viewModel.fetch(isLoadMore: isLoadMore) { [weak self] backgroundView, footerView in | ||
self?.collectionView.backgroundView = backgroundView | ||
} fetchDidFinish: { [weak self] isSuccess, message in | ||
self?.collectionView.reloadData() | ||
self?.refreshControl.endRefreshing() | ||
} | ||
} | ||
} | ||
|
||
extension GridVC { | ||
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
viewModel.numberOfItems | ||
} | ||
|
||
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! ItemCell | ||
cell.viewModel = viewModel.viewModelOfItem(at: indexPath) | ||
return cell | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | ||
let vc = StoryboardScene.Menu.exampleVC.instantiate() | ||
vc.viewModel = viewModel.viewModelOfItem(at: indexPath) | ||
self.navigationController?.pushViewController(vc, animated: true) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// LaunchScreenVC.swift | ||
// iOStarter | ||
// | ||
// Created by Macintosh on 01/04/22. | ||
// Copyright © 2022 WahyuAdyP. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class LaunchScreenVC: ViewController { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
startLaunchScreen() | ||
} | ||
|
||
func startLaunchScreen() { | ||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 3) { | ||
guard let vc = AppDelegate.shared.mainController else { return } | ||
vc.modalPresentationStyle = .fullScreen | ||
vc.modalTransitionStyle = .crossDissolve | ||
self.present(vc, animated: true, completion: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// LoginVC.swift | ||
// iOStarter | ||
// | ||
// Created by Macintosh on 05/04/22. | ||
// Copyright © 2022 dypme. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class LoginVC: ViewController { | ||
|
||
@IBOutlet weak var emailFld: UITextField! | ||
@IBOutlet weak var passwordFld: UITextField! | ||
@IBOutlet weak var loginBtn: UIButton! | ||
|
||
let viewModel = LoginVM() | ||
|
||
override func setupMethod() { | ||
super.setupMethod() | ||
|
||
loginBtn.addTarget(self, action: #selector(login), for: .touchUpInside) | ||
} | ||
|
||
@objc func login() { | ||
let email = emailFld.text! | ||
let password = passwordFld.text! | ||
|
||
if let errorMessage = viewModel.errorMessage(email: email, password: password) { | ||
self.simpleAlert(title: nil, message: errorMessage, handler: nil) | ||
return | ||
} | ||
viewModel.login(email: email, password: password) { [weak self] isSuccess, message in | ||
if isSuccess { | ||
let tabBarVC = self?.presentingViewController as? TabBarMenuVC | ||
tabBarVC?.setupMenu() | ||
self?.dismiss(animated: true, completion: nil) | ||
} else { | ||
self?.simpleAlert(title: nil, message: message, handler: nil) | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
iOStarter/Example/Controller/Menu/DrawerMenu/DrawerMenuVC.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.