Apple has today started supporting all UPI payments including Paytm,Amazon pay and etc.
Post
Replies
Boosts
Views
Activity
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:-
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)
}
}
}
}
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)
}
}
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.
I think you should try applying first aid on the disk using the system recovery and even resetting the Smc, cause it happened with me before and I’ve solved it using the following steps above and if it doesn’t work let me know again in reply.
i think most of the time users don’t know that they have profiles installed in their devices and they install some required apps like you said ‘null’ in this case, so what you can do is uninstall the profile from the settings and if this doesn’t work please let me know in reply.
Sorry for the inconvenience caused, this is not the expected behaviour from the device, but from what you've specified, the issue might be due to your full storage, so I suggest you to free up some space or use iCloud to backup your data.
If it doesn't work then use these following steps to resolve your issue:
Check if your iPhone is running on the latest version by going to the software update tab in general settings of your device.
Even if this doesn't resolve your issue, Reset all settings.
Even after this your issue does not resolve, Backup everything on your iPhone using your Mac or iCloud.
Erase your iPhone and install a the latest version again(might be software issue).
and even if this doesn't work then take your device to apple service centre as there might be hardware issue that's causing it.