Posts

Post not yet marked as solved
7 Replies
0 Views
First View:- import SwiftUI struct menjeans: View {   var menje:[UIImage] =     [UIImage(named:"IMG_9917")!,     UIImage(named:"IMG_9920")!,     UIImage(named:"IMG_9923")!]   var menjen:[String]=["CROPPED SKINNY JEANS\n₹2,990.00","SKINNY JEANS WITH CHAIN\n₹4,990.00","LOW-RISE SLIM JEANS\n₹2,990.00"]   var menjen2:[UIImage] =     [UIImage(named: "IMG_9918")!,     UIImage(named: "IMG_9922")!,      UIImage(named: "IMG_9925")!]   var menjen3:[UIImage] =     [UIImage(named: "IMG_9919")!,     UIImage(named: "IMG_9921")!,      UIImage(named: "IMG_9924")!]   let layout=[GridItem(.flexible()),GridItem(.flexible())]   var i=0  var body: some View   {      ScrollView(.vertical)       {       LazyVGrid(columns: layout,spacing: 2)         {           ForEach(Array(zip(menje,menjen)), id: .0)           {           (imager,texter) in             NavigationLink(destination:lastview(img:imager, texty: texter))             {               maincustom(content: Image(uiImage:imager), text: texter)             }           }           .navigationBarTitle("Men Jeans")         }       }       .navigationBarBackButtonHidden(true)       .navigationBarItems(leading:                   NavigationLink(                   destination: clothlist()){                       navcustom(content:                             Image(systemName: "line.horizontal.3"),col: .white)                   })     } struct menjeans_Previews: PreviewProvider {   static var previews: some View {     menjeans()       .environment(.colorScheme, .dark)   } } Last View:- import SwiftUI struct lastview: View {   var img:UIImage   var texty:String   var body: some View {     ScrollView(.vertical){     ScrollView(.horizontal){       HStack{     Image(uiImage: img)           .resizable()           .frame(width: 500, height: 500, alignment: .center)     Image(uiImage: img)           .resizable()           .frame(width: 500, height: 500, alignment: .center)     Image(uiImage: img)       .resizable()       .frame(width: 500, height: 500, alignment: .center)       }     }       VStack(alignment: .leading) {       Text(texty)       }    }   } } And the images are in old post of view. And the menje,menjen2,mejen3 contains images and menjen contains text related to the image in menje. menjen2 and menjen3 contain images related to images in menje or you can say it has relation with the images in menje so I need to print the images in menje,menjen2 and menje3 in last view after the user clicks on the image of menje in first view.
Post not yet marked as solved
7 Replies
0 Views
Actually i used zip because It worked in my app for iterating over 2 array, but when the number of array increased it is not working I don't know why. let ar=zip(zip(zip(menje, menjen), menjen2), menjen3) shows error:- Cannot use instance member 'menje' within property initializer; property initializers run before 'self' is available (for every array in it). As I posted code and what I want before, can you help me that what should I do to iterate over multiple array together and can separate the output with a specific name like:- ForEach(Array(zip(menje,menjen)), id: \.0) { (imager,texter) in // Like this I want to return different array values to other view.       NavigationLink(destination:lastview(img:imager, texty: texter)) { maincustom(content: Image(uiImage:imager), text: texter) } }
Post not yet marked as solved
7 Replies
0 Views
What iam trying to do is when going over from first view to last view, I want to display the images in last view related to the image which is clicked in first view with its text, below are som images for better understanding. First View:- When clicked an image:- Last view:- The image related to it has 3 different images array which Iam printing using scrollview:- And to print three different images for a particular image I've used different array but in the image above I've just printed image directly in scrollview as an example because Iam unable to iterate over multiple arrays together. code:- First View:- import SwiftUI struct menjeans: View {     var menje:[UIImage] =         [UIImage(named:"IMG_9917")!,         UIImage(named:"IMG_9920")!,         UIImage(named:"IMG_9923")!]     var menjen:[String]=["CROPPED SKINNY JEANS\n₹2,990.00","SKINNY JEANS WITH CHAIN\n₹4,990.00","LOW-RISE SLIM JEANS\n₹2,990.00"]     var menjen2:[UIImage] =         [UIImage(named: "IMG_9918")!,         UIImage(named: "IMG_9922")!,          UIImage(named: "IMG_9925")!]     var menjen3:[UIImage] =         [UIImage(named: "IMG_9919")!,         UIImage(named: "IMG_9921")!,          UIImage(named: "IMG_9924")!]     let layout=[GridItem(.flexible()),GridItem(.flexible())]     var i=0     var body: some View     {             ScrollView(.vertical)             {             LazyVGrid(columns: layout,spacing: 2)                 {                     ForEach(Array(zip(menje,menjen)), id: .0)                     {                     (imager,texter) in                         NavigationLink(destination:lastview(img:imager, texty: texter))                         {                             maincustom(content: Image(uiImage:imager), text: texter)                         }                     }                     .navigationBarTitle("Men Jeans")                 }             }             .navigationBarBackButtonHidden(true)             .navigationBarItems(leading:                                     NavigationLink(                                     destination: clothlist()){                                             navcustom(content:                                                        Image(systemName: "line.horizontal.3"),col: .white)                                     })         } struct menjeans_Previews: PreviewProvider {     static var previews: some View {         menjeans()             .environment(.colorScheme, .dark)     } } Last View:- import SwiftUI struct lastview: View {     var img:UIImage     var texty:String     var body: some View {         ScrollView(.vertical){         ScrollView(.horizontal){             HStack{         Image(uiImage: img)                     .resizable()                     .frame(width: 500, height: 500, alignment: .center)         Image(uiImage: img)                     .resizable()                     .frame(width: 500, height: 500, alignment: .center)         Image(uiImage: img)             .resizable()             .frame(width: 500, height: 500, alignment: .center)             }         }             VStack(alignment: .leading) {             Text(texty)             }         }     } }
Post not yet marked as solved
7 Replies
0 Views
I tried this :- ForEach(Array(zip(zip(menje,menjen),zip(menjen2,menjen3))), id: .0)                     {                     (imager,texter) in                         NavigationLink(destination:lastview(img:imager, texty: texter))                         {                             maincustom(content: Image(uiImage:imager), text: texter)                         }                     } got error:- and as you said I even tried this:- ForEach(Array(zip(zip(zip(menje,menjen)),menjen2),menjen3), id: .0)                     {                     (imager,texter) in                         NavigationLink(destination:lastview(img:imager, texty: texter))                         {                             maincustom(content: Image(uiImage:imager), text: texter)                         }                     } got error:-
Post not yet marked as solved
2 Replies
0 Views
Apple has today started supporting all UPI payments including Paytm,Amazon pay and etc.