- Added checks and error for the name, username and password - On gender select adding values to the post reg struct. - Handled the interest selection into a array to post to the reg struct - Finalised the Age Select vc with gender select, date select, interest select - Added Avatar API
73 lines
2.4 KiB
Swift
73 lines
2.4 KiB
Swift
//
|
|
// SelectAvatarVC.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 02/05/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SelectAvatarVC: UIViewController {
|
|
|
|
@IBOutlet weak var collectionView: UICollectionView!
|
|
@IBOutlet weak var nextBtn: LocalisedElementsButton!
|
|
|
|
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)
|
|
}
|
|
|
|
@IBAction func nextBtnTapped(_ sender: LocalisedElementsButton) {
|
|
}
|
|
}
|
|
|
|
// MARK: - CollectionView Delegate
|
|
|
|
extension SelectAvatarVC : UICollectionViewDelegate , UICollectionViewDataSource{
|
|
|
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
return vm.avatarData.count
|
|
}
|
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.Authentication.selectAvatarCell, for: indexPath) as! SelectAvatarCell
|
|
cell.setData(data: vm.avatarData[indexPath.row])
|
|
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)
|
|
}
|
|
}
|