From f55dda088382db6bc8b50456d924ad1d60c85214 Mon Sep 17 00:00:00 2001 From: BilalKhanWDI Date: Thu, 2 May 2024 19:30:09 +0530 Subject: [PATCH] 2nd May --- Podfile | 2 +- WOKA.xcodeproj/project.pbxproj | 40 ++++++ .../Base.lproj/AuthenticationSB.storyboard | 133 ++++++++++++++---- .../Controller/SelectAvatarVC.swift | 63 +++++++-- .../Controller/UserIntrestVC.swift | 93 +++++++++++- .../View/SelectAvatarCell.swift | 12 +- WOKA/Authentication/View/SelectAvatarCell.xib | 52 ++++++- .../Authentication/View/YourIntrestCell.swift | 19 ++- WOKA/Authentication/View/YourIntrestCell.xib | 60 +++++++- .../ViewModel/SelectAvatarVM.swift | 17 ++- .../ViewModel/UserIntrestVM.swift | 84 ++++++++++- WOKA/Constants K/CellIdentifier.swift | 5 + WOKA/Constants K/OnBoardVM.swift | 2 +- WOKA/Constants K/StoryBoardID.swift | 1 + WOKA/Default Enum/GenderEnum.swift | 6 + WOKA/Helpers/BorderView.swift | 9 +- .../Controller/SplashVC.swift | 57 ++++---- 17 files changed, 569 insertions(+), 86 deletions(-) diff --git a/Podfile b/Podfile index ce3c3b1..2f2eda5 100644 --- a/Podfile +++ b/Podfile @@ -7,7 +7,7 @@ target 'WOKA' do pod 'IQKeyboardManagerSwift', '~> 7.0.2' pod 'lottie-ios' - + # Bottom line is for removing IPHONEOS_DEPLOYMENT_TARGET post_install do |installer| installer.generated_projects.each do |project| diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 9df0059..879f01d 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -25,6 +25,14 @@ 52663FFB2BDFB1700001D8CE /* TextFieldShadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FFA2BDFB1700001D8CE /* TextFieldShadow.swift */; }; 5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */; }; 5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */; }; + 52C6E01B2BE383C000E22D59 /* YourIntrestCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0192BE383C000E22D59 /* YourIntrestCell.swift */; }; + 52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */; }; + 52C6E01E2BE3847F00E22D59 /* BorderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E01D2BE3847F00E22D59 /* BorderView.swift */; }; + 52C6E0212BE3ADE300E22D59 /* GenderEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0202BE3ADE300E22D59 /* GenderEnum.swift */; }; + 52C6E0232BE3B3E300E22D59 /* SelectAvatarVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0222BE3B3E300E22D59 /* SelectAvatarVC.swift */; }; + 52C6E0262BE3B46A00E22D59 /* SelectAvatarCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52C6E0252BE3B46A00E22D59 /* SelectAvatarCell.xib */; }; + 52C6E0272BE3B46A00E22D59 /* SelectAvatarCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0242BE3B46A00E22D59 /* SelectAvatarCell.swift */; }; + 52C6E0292BE3B52500E22D59 /* SelectAvatarVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C6E0282BE3B52500E22D59 /* SelectAvatarVM.swift */; }; 52C8B0542BDA4BD1003B51D0 /* RoundCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C8B0532BDA4BD1003B51D0 /* RoundCorner.swift */; }; 52C8B0572BDA57DB003B51D0 /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C8B0562BDA57DB003B51D0 /* Constant.swift */; }; 52C8B0592BDA57FA003B51D0 /* StaticFilesString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C8B0582BDA57FA003B51D0 /* StaticFilesString.swift */; }; @@ -111,6 +119,14 @@ 52663FFA2BDFB1700001D8CE /* TextFieldShadow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldShadow.swift; sourceTree = ""; }; 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetailsRegisterVC.swift; sourceTree = ""; }; 5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetailsRegisterVM.swift; sourceTree = ""; }; + 52C6E0192BE383C000E22D59 /* YourIntrestCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YourIntrestCell.swift; sourceTree = ""; }; + 52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = YourIntrestCell.xib; sourceTree = ""; }; + 52C6E01D2BE3847F00E22D59 /* BorderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BorderView.swift; sourceTree = ""; }; + 52C6E0202BE3ADE300E22D59 /* GenderEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenderEnum.swift; sourceTree = ""; }; + 52C6E0222BE3B3E300E22D59 /* SelectAvatarVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAvatarVC.swift; sourceTree = ""; }; + 52C6E0242BE3B46A00E22D59 /* SelectAvatarCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAvatarCell.swift; sourceTree = ""; }; + 52C6E0252BE3B46A00E22D59 /* SelectAvatarCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SelectAvatarCell.xib; sourceTree = ""; }; + 52C6E0282BE3B52500E22D59 /* SelectAvatarVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAvatarVM.swift; sourceTree = ""; }; 52C8B0532BDA4BD1003B51D0 /* RoundCorner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundCorner.swift; sourceTree = ""; }; 52C8B0562BDA57DB003B51D0 /* Constant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 52C8B0582BDA57FA003B51D0 /* StaticFilesString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticFilesString.swift; sourceTree = ""; }; @@ -239,6 +255,7 @@ 523ED25C2BDA2BC700CFED02 /* WOKA */ = { isa = PBXGroup; children = ( + 52C6E01F2BE3ADD800E22D59 /* Default Enum */, 9C56E83E2BDBE4FB00E4CA14 /* Authentication */, 9C27E1612BDB6F0F00EC1DA9 /* Main */, 9C27E15E2BDB6E4F00EC1DA9 /* Localized Module */, @@ -342,6 +359,14 @@ path = Fonts; sourceTree = ""; }; + 52C6E01F2BE3ADD800E22D59 /* Default Enum */ = { + isa = PBXGroup; + children = ( + 52C6E0202BE3ADE300E22D59 /* GenderEnum.swift */, + ); + path = "Default Enum"; + sourceTree = ""; + }; 52C8B0512BDA4B51003B51D0 /* Helpers */ = { isa = PBXGroup; children = ( @@ -352,6 +377,7 @@ 52663FF62BDFACF60001D8CE /* ShadowView.swift */, 5257B2642BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift */, 52D774F02BDFC53B001D87DE /* StringSubScript.swift */, + 52C6E01D2BE3847F00E22D59 /* BorderView.swift */, ); path = Helpers; sourceTree = ""; @@ -442,6 +468,10 @@ 9C56E8402BDBE50600E4CA14 /* View */ = { isa = PBXGroup; children = ( + 52C6E0192BE383C000E22D59 /* YourIntrestCell.swift */, + 52C6E01A2BE383C000E22D59 /* YourIntrestCell.xib */, + 52C6E0242BE3B46A00E22D59 /* SelectAvatarCell.swift */, + 52C6E0252BE3B46A00E22D59 /* SelectAvatarCell.xib */, ); path = View; sourceTree = ""; @@ -453,6 +483,7 @@ 52D774EC2BDFC13F001D87DE /* OTPVM.swift */, 5272FCE42BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift */, 52CA28FB2BE11A0400708B49 /* UserIntrestVM.swift */, + 52C6E0282BE3B52500E22D59 /* SelectAvatarVM.swift */, ); path = ViewModel; sourceTree = ""; @@ -464,6 +495,7 @@ 52D774EA2BDFC0BF001D87DE /* OTPVC.swift */, 5272FCE22BDFDB05000ECB1D /* UserDetailsRegisterVC.swift */, 52CA28F92BE119F500708B49 /* UserIntrestVC.swift */, + 52C6E0222BE3B3E300E22D59 /* SelectAvatarVC.swift */, ); path = Controller; sourceTree = ""; @@ -600,7 +632,9 @@ 523ED26A2BDA2BC900CFED02 /* Base in Resources */, 52C8B05B2BDA5924003B51D0 /* WokaSplashSound.m4a in Resources */, 523ED2652BDA2BC700CFED02 /* Base in Resources */, + 52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */, 9C56E8392BDBC3F000E4CA14 /* Exo2-Regular.ttf in Resources */, + 52C6E0262BE3B46A00E22D59 /* SelectAvatarCell.xib in Resources */, 52C8B0712BDA7512003B51D0 /* PassingCloud.json in Resources */, 9C56E8362BDBC3F000E4CA14 /* Exo2-SemiBold.ttf in Resources */, ); @@ -672,6 +706,7 @@ 52D774EF2BDFC50D001D87DE /* StringValidations.swift in Sources */, 5272FCE32BDFDB05000ECB1D /* UserDetailsRegisterVC.swift in Sources */, 5202AAFE2BDF90590043B7BD /* TextFieldImage.swift in Sources */, + 52C6E0232BE3B3E300E22D59 /* SelectAvatarVC.swift in Sources */, 52C8B06C2BDA6E87003B51D0 /* LocalizedString.swift in Sources */, 52CC38C32BDF812F00B74C3E /* LocalisedElements.swift in Sources */, 52CA28FC2BE11A0400708B49 /* UserIntrestVM.swift in Sources */, @@ -685,8 +720,10 @@ 52D774EB2BDFC0BF001D87DE /* OTPVC.swift in Sources */, 9C27E16F2BDB866500EC1DA9 /* CellIdentifier.swift in Sources */, 9C27E1632BDB6F1900EC1DA9 /* AuthFunc.swift in Sources */, + 52C6E0292BE3B52500E22D59 /* SelectAvatarVM.swift in Sources */, 52C8B0592BDA57FA003B51D0 /* StaticFilesString.swift in Sources */, 52C8B05D2BDA5AA7003B51D0 /* ApplyGradrient.swift in Sources */, + 52C6E01B2BE383C000E22D59 /* YourIntrestCell.swift in Sources */, 523ED25E2BDA2BC700CFED02 /* AppDelegate.swift in Sources */, 52D774ED2BDFC13F001D87DE /* OTPVM.swift in Sources */, 9C56E83B2BDBC6E600E4CA14 /* SelectAgeVM.swift in Sources */, @@ -696,6 +733,7 @@ 52D774E92BDFBDA4001D87DE /* AuthenticationStringConstant.swift in Sources */, 9C27E1672BDB706700EC1DA9 /* StoryBoard.swift in Sources */, 52C8B0692BDA6E1E003B51D0 /* LocalizedEnum.swift in Sources */, + 52C6E01E2BE3847F00E22D59 /* BorderView.swift in Sources */, 52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */, 9C56E8482BDBEFAB00E4CA14 /* AssetColor.swift in Sources */, 5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */, @@ -711,6 +749,8 @@ 9C27E16D2BDB852F00EC1DA9 /* GVar.swift in Sources */, 9C56E8462BDBEE6400E4CA14 /* EmailVC.swift in Sources */, 52663FFB2BDFB1700001D8CE /* TextFieldShadow.swift in Sources */, + 52C6E0212BE3ADE300E22D59 /* GenderEnum.swift in Sources */, + 52C6E0272BE3B46A00E22D59 /* SelectAvatarCell.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard index a3b0f45..cb0e816 100644 --- a/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard +++ b/WOKA/Authentication/Base.lproj/AuthenticationSB.storyboard @@ -504,8 +504,8 @@ Sent to Your Parent’s Email - - + + @@ -532,13 +532,13 @@ Sent to Your Parent’s Email - + - + - + - - + + - + - - + + - - + + - + - + + + + + + + + + + + + + + + - + @@ -661,6 +678,7 @@ Sent to Your Parent’s Email + @@ -683,14 +701,81 @@ Sent to Your Parent’s Email + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Authentication/Controller/SelectAvatarVC.swift b/WOKA/Authentication/Controller/SelectAvatarVC.swift index 85954aa..d1ea4e4 100644 --- a/WOKA/Authentication/Controller/SelectAvatarVC.swift +++ b/WOKA/Authentication/Controller/SelectAvatarVC.swift @@ -9,21 +9,60 @@ import UIKit class SelectAvatarVC: UIViewController { + @IBOutlet weak var collectionView: UICollectionView! + + var vm = SelectAvatarVM() + override func viewDidLoad() { super.viewDidLoad() - - // Do any additional setup after loading the view. + vm.vc = self + vm.initView() } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. + 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) } - */ - } diff --git a/WOKA/Authentication/Controller/UserIntrestVC.swift b/WOKA/Authentication/Controller/UserIntrestVC.swift index b1e480b..d46d78b 100644 --- a/WOKA/Authentication/Controller/UserIntrestVC.swift +++ b/WOKA/Authentication/Controller/UserIntrestVC.swift @@ -6,14 +6,35 @@ // import UIKit +struct Temp{ + let text : String? + var selected : Bool? +} class UserIntrestVC: UIViewController { - + @IBOutlet weak var boyView: UIView! @IBOutlet weak var girlView: UIView! @IBOutlet weak var datePicker: UIDatePicker! + @IBOutlet weak var collectionView: UICollectionView! + @IBOutlet weak var nextBtn: LocalisedElementsButton! + @IBOutlet weak var scrollView: UIScrollView! + + @IBOutlet weak var contentHeight: NSLayoutConstraint! var vm = UserIntrestVM() + var test = [Temp(text: "ADVENTURES", selected: false), + Temp(text: "CARTOONS", selected: false), + Temp(text: "SUPER HEROES", selected: false), + Temp(text: "SPORTS", selected: false), + Temp(text: "SCIENCE", selected: false), + Temp(text: "TRAVEL", selected: false), + Temp(text: "ADVENTURES", selected: false), + Temp(text: "CARTOONS", selected: false), + Temp(text: "SUPER HEROES", selected: false), + Temp(text: "SPORTS", selected: false), + Temp(text: "SCIENCE", selected: false), + Temp(text: "TRAVEL", selected: false)] override func viewDidLoad() { super.viewDidLoad() @@ -23,6 +44,74 @@ class UserIntrestVC: UIViewController { boyView.roundCorner(radius: 25) girlView.roundCorner(radius: 25) datePicker.setValue(UIColor.appColor(.TextDarkBlue), forKeyPath: "textColor") - + + } + + 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) { + let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil) + let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.selectAvatarVC) as! SelectAvatarVC + self.navigationController?.pushViewController(vc, animated: true) } } + +// MARK: - CollectionView Delegate + +extension UserIntrestVC : UICollectionViewDelegate , UICollectionViewDataSource{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return test.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.Authentication.yourIntrestCell, for: indexPath) as! YourIntrestCell + cell.setData(text: test[indexPath.row].text!,selected: test[indexPath.row].selected!) + return cell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + test[indexPath.row].selected?.toggle() + + UIView.performWithoutAnimation { + self.collectionView.reloadItems(at: [IndexPath(row: indexPath.row, section: 0)]) + } + } +} + +// MARK: - Collection Flow Layout + +extension UserIntrestVC : UICollectionViewDelegateFlowLayout{ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + // Generate a random string for testing purposes + let randomText = test[indexPath.row].text! + + // Define the font for the text + let font = UIFont.systemFont(ofSize: 14) // You can adjust the font size as needed + + // Calculate the width of the text + let textWidth = randomText.size(withAttributes: [.font: font]).width + + // Set the cell width based on the text width and any additional padding + let cellWidth = textWidth + 25 // Add any additional spacing you want + + return CGSize(width: cellWidth, height: 45) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + section == 0 ? 15 : 5 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) + } + +} diff --git a/WOKA/Authentication/View/SelectAvatarCell.swift b/WOKA/Authentication/View/SelectAvatarCell.swift index 5714f56..7584b5f 100644 --- a/WOKA/Authentication/View/SelectAvatarCell.swift +++ b/WOKA/Authentication/View/SelectAvatarCell.swift @@ -9,9 +9,19 @@ import UIKit class SelectAvatarCell: UICollectionViewCell { + @IBOutlet weak var outerView: UIView! + @IBOutlet weak var imageView: UIImageView! + override func awakeFromNib() { super.awakeFromNib() - // Initialization code + self.outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5) } + override func layoutSubviews() { + self.outerView.roundCorner() + } + + func setData(){ +// self.imageView.image = UIImage(named: "avatar") + } } diff --git a/WOKA/Authentication/View/SelectAvatarCell.xib b/WOKA/Authentication/View/SelectAvatarCell.xib index dab4371..0f926c9 100644 --- a/WOKA/Authentication/View/SelectAvatarCell.xib +++ b/WOKA/Authentication/View/SelectAvatarCell.xib @@ -1,21 +1,59 @@ - - + + + - + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Authentication/View/YourIntrestCell.swift b/WOKA/Authentication/View/YourIntrestCell.swift index 24e6880..bace994 100644 --- a/WOKA/Authentication/View/YourIntrestCell.swift +++ b/WOKA/Authentication/View/YourIntrestCell.swift @@ -9,9 +9,26 @@ import UIKit class YourIntrestCell: UICollectionViewCell { + @IBOutlet weak var outerView: UIView! + @IBOutlet weak var intrestLabel: UILabel! + override func awakeFromNib() { super.awakeFromNib() - // Initialization code + } + + override func layoutSubviews() { + outerView.roundCorner(radius: 20) +// outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5) + } + + func setData(text : String,selected : Bool){ + intrestLabel.text = text + + if selected{ + outerView.backgroundColor = UIColor.white + }else{ + outerView.backgroundColor = UIColor.white.withAlphaComponent(0.5) + } } } diff --git a/WOKA/Authentication/View/YourIntrestCell.xib b/WOKA/Authentication/View/YourIntrestCell.xib index 3d9608c..3afa1ea 100644 --- a/WOKA/Authentication/View/YourIntrestCell.xib +++ b/WOKA/Authentication/View/YourIntrestCell.xib @@ -1,21 +1,67 @@ - - + + + - + + + + + + Exo2-Bold + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Authentication/ViewModel/SelectAvatarVM.swift b/WOKA/Authentication/ViewModel/SelectAvatarVM.swift index fce52d8..cd8f9ec 100644 --- a/WOKA/Authentication/ViewModel/SelectAvatarVM.swift +++ b/WOKA/Authentication/ViewModel/SelectAvatarVM.swift @@ -5,4 +5,19 @@ // Created by MacBook Pro on 02/05/24. // -import Foundation +import UIKit + +class SelectAvatarVM{ + + weak var vc : SelectAvatarVC! + + func initView(){ + setupCell() + } + + func setupCell(){ + vc.collectionView.register(UINib(nibName: K.CellIdentifier.Authentication.selectAvatarCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Authentication.selectAvatarCell) + vc.collectionView.delegate = self.vc + vc.collectionView.dataSource = self.vc + } +} diff --git a/WOKA/Authentication/ViewModel/UserIntrestVM.swift b/WOKA/Authentication/ViewModel/UserIntrestVM.swift index 1c1290a..3bbed3b 100644 --- a/WOKA/Authentication/ViewModel/UserIntrestVM.swift +++ b/WOKA/Authentication/ViewModel/UserIntrestVM.swift @@ -5,13 +5,95 @@ // Created by MacBook Pro on 30/04/24. // -import Foundation +import UIKit class UserIntrestVM{ weak var vc : UserIntrestVC! + var gender = GenderEnum.none func initView(){ + setupCell() + let bottomPadding: CGFloat = 60 // Adjust this value as needed + + // Get the current content inset + var contentInset = vc.scrollView.contentInset + + // Add bottom padding + contentInset.bottom = bottomPadding + + // Set the updated content inset + vc.scrollView.contentInset = contentInset + + let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1) + let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1) + vc.nextBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) + vc.nextBtn.roundCorner() + + /* + Set the collectionview height + */ + let height = self.vc.collectionView.collectionViewLayout.collectionViewContentSize.height + self.vc.contentHeight.constant = height + vc.view.layoutIfNeeded() + + // Add tap gesture recognizer to the view + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(boyBtnTapped)) + vc.boyView.addGestureRecognizer(tapGesture) + + // Add tap gesture recognizer to the view + let tapGesture2 = UITapGestureRecognizer(target: self, action: #selector(girlBtnTapped)) + vc.girlView.addGestureRecognizer(tapGesture2) + + setGender() + } + + func setGender(){ + let alphaComp = 0.6 + switch gender{ + case .boy: + vc.boyView.backgroundColor = UIColor.white + vc.girlView.backgroundColor = UIColor.white.withAlphaComponent(alphaComp) + case .girl: + vc.girlView.backgroundColor = UIColor.white + vc.boyView.backgroundColor = UIColor.white.withAlphaComponent(alphaComp) + case .none: + vc.girlView.backgroundColor = UIColor.white.withAlphaComponent(alphaComp) + vc.boyView.backgroundColor = UIColor.white.withAlphaComponent(alphaComp) + } + } + + @objc func boyBtnTapped() { + // Apply click effect animation + gender = .boy + UIView.animate(withDuration: 0.1, animations: { + self.vc.boyView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) + }) { _ in + UIView.animate(withDuration: 0.1) { + self.vc.boyView.transform = .identity + self.setGender() + } + } + + } + + @objc func girlBtnTapped() { + gender = .girl + // Apply click effect animation + UIView.animate(withDuration: 0.1, animations: { + self.vc.girlView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) + }) { _ in + UIView.animate(withDuration: 0.1) { + self.vc.girlView.transform = .identity + self.setGender() + } + } + } + + func setupCell(){ + vc.collectionView.register(UINib(nibName: K.CellIdentifier.Authentication.yourIntrestCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.Authentication.yourIntrestCell) + vc.collectionView.delegate = self.vc + vc.collectionView.dataSource = self.vc } } diff --git a/WOKA/Constants K/CellIdentifier.swift b/WOKA/Constants K/CellIdentifier.swift index ac334a0..b5f4b72 100644 --- a/WOKA/Constants K/CellIdentifier.swift +++ b/WOKA/Constants K/CellIdentifier.swift @@ -16,5 +16,10 @@ extension K{ // } + + struct Authentication{ + static let yourIntrestCell = "YourIntrestCell" + static let selectAvatarCell = "SelectAvatarCell" + } } } diff --git a/WOKA/Constants K/OnBoardVM.swift b/WOKA/Constants K/OnBoardVM.swift index f9c3059..76df2d3 100644 --- a/WOKA/Constants K/OnBoardVM.swift +++ b/WOKA/Constants K/OnBoardVM.swift @@ -58,7 +58,7 @@ class OnBoardVM{ } func animateWokaLogo(){ - var topConstriant = CheckPhoneHomeBtnOrNotch.shareInstance.topConstriant() + let topConstriant = CheckPhoneHomeBtnOrNotch.shareInstance.topConstriant() UIView.animate(withDuration: 0.6, animations: { self.vc.wokaLogoTopConstriant.constant = topConstriant diff --git a/WOKA/Constants K/StoryBoardID.swift b/WOKA/Constants K/StoryBoardID.swift index 8271ddc..19f2fe7 100644 --- a/WOKA/Constants K/StoryBoardID.swift +++ b/WOKA/Constants K/StoryBoardID.swift @@ -22,6 +22,7 @@ extension K{ static let oTPVC = "OTPVC" static let userDetailsRegisterVC = "UserDetailsRegisterVC" static let userIntrestVC = "UserIntrestVC" + static let selectAvatarVC = "SelectAvatarVC" } } diff --git a/WOKA/Default Enum/GenderEnum.swift b/WOKA/Default Enum/GenderEnum.swift index 6be45c1..e32d7ed 100644 --- a/WOKA/Default Enum/GenderEnum.swift +++ b/WOKA/Default Enum/GenderEnum.swift @@ -6,3 +6,9 @@ // import Foundation + +enum GenderEnum{ + case boy + case girl + case none +} diff --git a/WOKA/Helpers/BorderView.swift b/WOKA/Helpers/BorderView.swift index d670ed1..41a0595 100644 --- a/WOKA/Helpers/BorderView.swift +++ b/WOKA/Helpers/BorderView.swift @@ -5,4 +5,11 @@ // Created by MacBook Pro on 02/05/24. // -import Foundation +import UIKit + +extension UIView{ + func addBorderView(width : CGFloat , color : UIColor){ + self.layer.borderWidth = width + self.layer.borderColor = color.cgColor + } +} diff --git a/WOKA/OnBoarding Module/Controller/SplashVC.swift b/WOKA/OnBoarding Module/Controller/SplashVC.swift index 7035efe..9d11623 100644 --- a/WOKA/OnBoarding Module/Controller/SplashVC.swift +++ b/WOKA/OnBoarding Module/Controller/SplashVC.swift @@ -29,33 +29,36 @@ class SplashVC: UIViewController { } @IBAction func languageBtnTapped(_ sender: UIButton) { - switch sender{ - case hindiBtn: - K.GVar.localized = K.LocalizedEnum.hindi - case englishBtn: - K.GVar.localized = K.LocalizedEnum.english - default: - K.GVar.localized = K.LocalizedEnum.english - } - - let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil) - let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.onBoardVC) as! OnBoardVC - - // Create a CATransition instance - let transition = CATransition() - transition.duration = 0.3 // Set the duration of the animation - transition.type = CATransitionType.fade // Set the type of animation to fade - - // Optionally, set other properties such as timing function, subtype, etc. - // transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) - // transition.subtype = CATransitionSubtype.fromTop - - // Get the navigation controller - guard let navigationController = navigationController else { return } - - // Perform the push animation with the custom transition - navigationController.view.layer.add(transition, forKey: nil) - navigationController.pushViewController(vc, animated: false) + let sb = UIStoryboard(name: K.StoryBoard.authenticationSB, bundle: nil) + let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Authentication.userIntrestVC) as! UserIntrestVC + self.navigationController?.pushViewController(vc, animated: true) +// switch sender{ +// case hindiBtn: +// K.GVar.localized = K.LocalizedEnum.hindi +// case englishBtn: +// K.GVar.localized = K.LocalizedEnum.english +// default: +// K.GVar.localized = K.LocalizedEnum.english +// } +// +// let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil) +// let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.onBoardVC) as! OnBoardVC +// +// // Create a CATransition instance +// let transition = CATransition() +// transition.duration = 0.3 // Set the duration of the animation +// transition.type = CATransitionType.fade // Set the type of animation to fade +// +// // Optionally, set other properties such as timing function, subtype, etc. +// // transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) +// // transition.subtype = CATransitionSubtype.fromTop +// +// // Get the navigation controller +// guard let navigationController = navigationController else { return } +// +// // Perform the push animation with the custom transition +// navigationController.view.layer.add(transition, forKey: nil) +// navigationController.pushViewController(vc, animated: false) } func animateImageScale() {