diff --git a/nirvana-ios.xcodeproj/project.pbxproj b/nirvana-ios.xcodeproj/project.pbxproj index f079c4b..f7b8284 100644 --- a/nirvana-ios.xcodeproj/project.pbxproj +++ b/nirvana-ios.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 891A160B2765732700B26659 /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160A2765732700B26659 /* HomeViewModel.swift */; }; 891A160E27657CEA00B26659 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A160D27657CEA00B26659 /* User.swift */; }; 891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A1610276590B000B26659 /* ChatsCarouselView.swift */; }; + 891A16132765A44300B26659 /* ChatsCarouselViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891A16122765A44300B26659 /* ChatsCarouselViewModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -42,6 +43,7 @@ 891A160A2765732700B26659 /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = ""; }; 891A160D27657CEA00B26659 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 891A1610276590B000B26659 /* ChatsCarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsCarouselView.swift; sourceTree = ""; }; + 891A16122765A44300B26659 /* ChatsCarouselViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsCarouselViewModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -162,6 +164,7 @@ isa = PBXGroup; children = ( 891A1610276590B000B26659 /* ChatsCarouselView.swift */, + 891A16122765A44300B26659 /* ChatsCarouselViewModel.swift */, ); path = ChatsCarouselView; sourceTree = ""; @@ -244,6 +247,7 @@ 891A15F5276557AB00B26659 /* colors.swift in Sources */, 891A15F9276563CA00B26659 /* WelcomeView.swift in Sources */, 891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */, + 891A16132765A44300B26659 /* ChatsCarouselViewModel.swift in Sources */, 891A15E127653A7000B26659 /* nirvana_iosApp.swift in Sources */, 891A160127656FB200B26659 /* Footer.swift in Sources */, 891A15FF27656F9200B26659 /* HeaderView.swift in Sources */, diff --git a/nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/dummy_profile_picture.jpeg b/nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/dummy_profile_picture.jpeg deleted file mode 100644 index 7fc82a5..0000000 Binary files a/nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/dummy_profile_picture.jpeg and /dev/null differ diff --git a/nirvana-ios/Assets.xcassets/profile pictures/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/nirvana-ios/Assets.xcassets/profile pictures/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/Contents.json similarity index 84% rename from nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/Contents.json rename to nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/Contents.json index 81f7f82..f9b5a8e 100644 --- a/nirvana-ios/Assets.xcassets/dummy_profile_picture.imageset/Contents.json +++ b/nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "dummy_profile_picture.jpeg", + "filename" : "heran.jpeg", "idiom" : "universal", "scale" : "1x" }, diff --git a/nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/heran.jpeg b/nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/heran.jpeg new file mode 100644 index 0000000..a4a0366 Binary files /dev/null and b/nirvana-ios/Assets.xcassets/profile pictures/heran.imageset/heran.jpeg differ diff --git a/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/Contents.json new file mode 100644 index 0000000..d2621df --- /dev/null +++ b/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "kevin.jpeg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/kevin.jpeg b/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/kevin.jpeg new file mode 100644 index 0000000..e5487f0 Binary files /dev/null and b/nirvana-ios/Assets.xcassets/profile pictures/kevin.imageset/kevin.jpeg differ diff --git a/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/Contents.json new file mode 100644 index 0000000..fe3f44e --- /dev/null +++ b/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "liam.jpeg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/liam.jpeg b/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/liam.jpeg new file mode 100644 index 0000000..5142f73 Binary files /dev/null and b/nirvana-ios/Assets.xcassets/profile pictures/liam.imageset/liam.jpeg differ diff --git a/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/Contents.json new file mode 100644 index 0000000..aa57562 --- /dev/null +++ b/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "rohan.jpeg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/rohan.jpeg b/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/rohan.jpeg new file mode 100644 index 0000000..bf1f01b Binary files /dev/null and b/nirvana-ios/Assets.xcassets/profile pictures/rohan.imageset/rohan.jpeg differ diff --git a/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/Contents.json b/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/Contents.json new file mode 100644 index 0000000..b81f32a --- /dev/null +++ b/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "sarth.jpeg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/sarth.jpeg b/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/sarth.jpeg new file mode 100644 index 0000000..448b7dd Binary files /dev/null and b/nirvana-ios/Assets.xcassets/profile pictures/sarth.imageset/sarth.jpeg differ diff --git a/nirvana-ios/Models/User.swift b/nirvana-ios/Models/User.swift index 6520805..59b3a7a 100644 --- a/nirvana-ios/Models/User.swift +++ b/nirvana-ios/Models/User.swift @@ -9,10 +9,17 @@ import Foundation import SwiftUI class User: Identifiable { - var id = UUID() - var profilePictureUrl:String = "" - var firstName:String = "" - var lastName:String = "" - var name:String = "" + var id = UUID().uuidString + var profilePictureUrl:String + var firstName:String + var lastName:String + var name:String? + + init(_id:String = UUID().uuidString, _profilePic:String, _firstN:String, _lastN:String) { + self.id = _id + self.profilePictureUrl = _profilePic + self.firstName = _firstN + self.lastName = _lastN + } } diff --git a/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselView.swift b/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselView.swift index 2b9b684..0c5ddf9 100644 --- a/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselView.swift +++ b/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselView.swift @@ -8,44 +8,47 @@ import SwiftUI struct ChatsCarouselView: View { + @StateObject var viewModel:ChatsCarouselViewModel = ChatsCarouselViewModel() + var body: some View { mainCarouselView } var mainCarouselView: some View { TabView { - ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { item in + ForEach(viewModel.carouselUsers) { carouselUser in GeometryReader {proxy in let minX = proxy.frame(in: .global).minX - - carouselUser - .rotation3DEffect(.degrees(minX / -10), axis: (x: 0, y: 1, z: 0)) - .shadow(color: Color("Shadow").opacity(0.3), radius: 10, x:0, y:10) - .blur(radius: abs(minX) / 40) - - Text("\(minX)") + + Image(carouselUser.profilePictureUrl) + .renderingMode(.original) + .resizable() + .aspectRatio(contentMode: .fit) + .clipShape(Circle()) + .shadow(radius: 10) + .padding() + .rotation3DEffect(.degrees(minX / -10), axis: (x: 0, y: 1, z: 0)) + .blur(radius: abs(minX) / 40) + + } } } .tabViewStyle(.page(indexDisplayMode: .always)) .frame(height: 400) + .padding(.top, 50) + .padding(.horizontal, 30) + } //the bottom navigation of the small profile pictures // var navigationCarouselView: some View { } - var carouselUser: some View { - Image("dummy_profile_picture") - .renderingMode(.original) - .resizable() - .aspectRatio(contentMode: .fit) - .cornerRadius(0) - .clipShape(Circle()) - } } struct ChatsCarouselView_Previews: PreviewProvider { static var previews: some View { - ChatsCarouselView() + HomeView() } } + diff --git a/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselViewModel.swift b/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselViewModel.swift new file mode 100644 index 0000000..bbce3cd --- /dev/null +++ b/nirvana-ios/Views/HomeView/ChatsCarouselView/ChatsCarouselViewModel.swift @@ -0,0 +1,30 @@ +// +// ChatsCarouselViewModel.swift +// nirvana-ios +// +// Created by Arjun Patel on 12/11/21. +// + +import Foundation + +final class ChatsCarouselViewModel: ObservableObject { + @Published var carouselUsers:[CarouselUser] = [] + + init() { + carouselUsers = [ + CarouselUser(_profilePic: "liam", _firstN: "Liam", _lastN: "Digregorio"), + CarouselUser(_profilePic: "heran", _firstN: "Heran", _lastN: "Patel"), + CarouselUser(_profilePic: "sarth", _firstN: "Sarth", _lastN: "Shah"), + CarouselUser(_profilePic: "kevin", _firstN: "Kevin", _lastN: "Le"), + CarouselUser(_profilePic: "rohan", _firstN: "Rohan", _lastN: "Chadha") + ] + } +} + +class CarouselUser: User { + // add anything specific needed in the view for carousel + // perhaps notification information for each + // their messages? +} + +//sample data diff --git a/nirvana-ios/Views/HomeView/HomeViewModel.swift b/nirvana-ios/Views/HomeView/HomeViewModel.swift index 151e2d1..4059422 100644 --- a/nirvana-ios/Views/HomeView/HomeViewModel.swift +++ b/nirvana-ios/Views/HomeView/HomeViewModel.swift @@ -8,6 +8,5 @@ import Foundation final class HomeViewModel: ObservableObject { - @Published var personalUsers: [User] = [] }