69 lines
2.2 KiB
Swift
69 lines
2.2 KiB
Swift
//
|
|
// SelectAvatarVC.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 02/05/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SelectAvatarVC: UIViewController {
|
|
|
|
@IBOutlet weak var collectionView: UICollectionView!
|
|
|
|
var vm = SelectAvatarVM()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
vm.vc = self
|
|
vm.initView()
|
|
}
|
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
super.viewWillAppear(animated)
|
|
navigationController?.setNavigationBarHidden(false, animated: animated)
|
|
}
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
super.viewWillDisappear(animated)
|
|
navigationController?.setNavigationBarHidden(true, animated: animated)
|
|
}
|
|
}
|
|
|
|
// MARK: - CollectionView Delegate
|
|
|
|
extension SelectAvatarVC : UICollectionViewDelegate , UICollectionViewDataSource{
|
|
|
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
return 10
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.Authentication.selectAvatarCell, for: indexPath) as! SelectAvatarCell
|
|
cell.setData()
|
|
return cell
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
|
|
}
|
|
}
|
|
|
|
// MARK: - Collection Flow Layout
|
|
|
|
extension SelectAvatarVC : UICollectionViewDelegateFlowLayout{
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
|
return 10
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
|
let noOfItems = self.collectionView.frame.width
|
|
let size = ((noOfItems / 3) - 10)
|
|
return CGSize(width: size, height: size)
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
}
|
|
}
|