Post

Replies

Boosts

Views

Activity

Reply to APP login
Which app are you talking about? Which version of iOS are you talking about? And how does the input box "not work"? If this app is developed by a third-party - not Apple - then you should probably speak to the developer of that app, and not we random developers on here. We don't work for Apple, and it's also unlikely that the specific developer of whatever app you're talking about is on here reading your extremely vague post.
Dec ’24
Reply to cannot find in scope
Okay, well, you went ahead anyway. Here's my update: // ContentView.swift import SwiftUI struct ContentView: View { @State private var tipa: [Double] = [] @State private var costa: [Double] = [] @State private var cost = "" @State private var costt: Double? = 0.0 @State private var paidt: Double? = 0.0 @State private var paid = "" @State private var tipp = "" @State private var tipc = "" @State private var tipaa = "" @State private var totalCost = "" @State private var totalTips = "" @State private var totalCash = "" @State private var tipcc = "" @State private var numbc = "" @State private var deletep = 0 @State private var number = 0 @State private var errorMsg = "" var body: some View { GeometryReader { g in NavigationStack { VStack { HStack { // No need to manually pad the date out with spaces, which will never be correct. // Just use an HStack and put a Spacer() in, so it goes: |<.....Spacer().....>Date| Spacer() Text(Date().formatted(date: .numeric, time: .omitted)) .foregroundStyle(Color.black) .fontWeight(.bold) .padding(.trailing, 10) } Text("Driver's Food Delivery") .font(.largeTitle) .fontWeight(.bold) Image("Screenshot 2024") VStack { Spacer() Text(errorMsg) .foregroundStyle(Color.red) // Here, put the text in one Text element, and tell SwiftUI to put it on two lines. // No need for msg/msg2 variables. Text("Enter cost and how much was paid. Enter numbers and one decimal point only, then press Enter.") .foregroundStyle(Color.blue) .lineLimit(2, reservesSpace: true) Spacer() } // Use a Grid to lay out your data; much cleaner, and SwiftUI will keep it in columns for you Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Cost") .gridColumnAlignment(.leading) Text("Paid") .gridColumnAlignment(.leading) Text("Tip") .gridColumnAlignment(.trailing) Text("Tip %") .gridColumnAlignment(.trailing) } .font(.headline) GridRow { TextField("Cost", text: $cost) .padding(10) .background(Color.brown) .cornerRadius(12) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.leading) TextField("Paid", text: $paid) .padding(10) .background(Color.brown) .cornerRadius(12) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.leading) Text(tipp) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.trailing) Text(tipc) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.trailing) } } .padding(.vertical, 20) HStack { Button { enterPayment() } label: { Text("Enter") .font(.title2) .padding(10) .background(Color.green) .foregroundStyle(Color.white) .cornerRadius(12) } .padding(.leading, 10) // Keeps it off the edge of the screen NavigationLink(destination: ViewDetail()) { Text("Detail") .font(.title2) .padding(10) .background(Color.blue) .foregroundStyle(Color.white) .cornerRadius(12) } Spacer() // Leaves a gap between the Enter & Detail buttons, and the destructive Delete button Button { delete(costa: &costa, tipa: &tipa, number: &number) } label: { Text("Delete") .font(.title2) .padding(10) .background(Color.red) .foregroundStyle(Color.white) .cornerRadius(12) } .padding(.trailing, 10) // Keeps it off the edge of the screen } Divider() // Nice little divider .padding(.vertical, 20) } VStack { Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Avg. Tip") .padding(.horizontal, 20) Text("Tip %") .padding(.horizontal, 20) Text("#") .padding(.horizontal, 20) } .gridColumnAlignment(.center) .font(.title3) GridRow { Text(tipaa) .padding(.horizontal, 20) Text(tipcc) .padding(.horizontal, 20) Text(numbc) .padding(.horizontal, 20) } .gridColumnAlignment(.center) .font(.system(size: 22, weight: .bold)) .foregroundStyle(Color.blue) } Spacer() } VStack { Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Total Cost") .padding(.horizontal, 10) Text("Total Tips") .padding(.horizontal, 10) Text("Total Cash") .padding(.horizontal, 10) } .gridColumnAlignment(.center) .font(.title3) GridRow { Text(totalCost) .padding(.horizontal, 10) Text(totalTips) .padding(.horizontal, 10) Text(totalCash) .padding(.horizontal, 10) } .gridColumnAlignment(.center) .font(.system(size: 22, weight: .bold)) .foregroundStyle(Color.blue) } Spacer() } } } } func enterPayment() { var ttips = 0.0 var tcost = 0.0 var tipo = 0.00 costt = Double(cost) paidt = Double(paid) errorMsg = "" if(costt != nil && paidt != nil) { tipo = Double(paid)! - Double(cost)! tipa.append(tipo) costa.append(Double(cost)!) number += 1 numbc = String(number) ttips = (tipa.reduce(0, +)) tcost = (costa.reduce(0, +)) tipaa = (ttips / Double(number)).formatted(.currency(code: "USD")) totalTips = ttips.formatted(.currency(code: "USD")) totalCost = tcost.formatted(.currency(code: "USD")) tipp = tipo.formatted(.currency(code: "USD")) tipc = String(tipo / Double(cost)! * 100) tipc = String(format: "%3.0f%%", Double(tipc)!) tipcc = String(ttips / tcost * 100) tipcc = String(format: "%3.0f%%", Double(tipcc)!) totalCash = (tcost + ttips).formatted(.currency(code: "USD")) } else { errorMsg = "Enter numbers and 1 decimal point only." } } } struct ViewDetail: View { @State var text1: String = "" @State var tip1: String = "" @State var text23: String = "" @State var tip23: String = "" var body: some View { Text(text1) Text(tip1) Text(text23) Text(tip23) } func detailLine(costa: inout [Double], tipa: inout [Double]) { print(costa, tipa) text1 = "125" print("detail") } } func delete(costa: inout [Double], tipa: inout [Double], number: inout Int) { print(costa, tipa) tipa.removeLast() costa.removeLast() number -= 1 print(costa,tipa) } #Preview { ContentView() }
Dec ’24
Reply to cannot find in scope
Don't post the whole program. Aside from the fact it's far too much code and you'll end up posting it over numerous posts, you still haven't mastered the use of the code formatting tool so we won't be able to understand it anyway. Please just reduce your code to the smallest bit possible - remove any formatting that's unnecessary, like fonts and padding etc. - you can add it back later. As @Claude31 was saying, use a Binding to pass values from one View to another, something like this: struct ViewOne: View { @State private var firstNames: [String] = ["Dave", "Geoff", "Bob", "Charlie"] var body: some View { Text("Some text") ViewTwo(firstNames: $firstNames) } } struct ViewTwo: View { @Binding firstNames: [String] var body: some View { firstNames.forEach { name in Text("Current name = '\(name)'") } } } That should display this: Some text Current name = 'Dave' Current name = 'Geoff' Current name = 'Bob' Current name = 'Charlie'
Dec ’24
Reply to Sound not working on iPad 7th generation
You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums. You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them. We use these forums to ask for help on coding our apps; not for pointing out bugs in a beta version of the software. Please report bugs in the usual way.
Dec ’24
Reply to Rooted iPhone 15 Pro
You're in the wrong place. This is nothing to do with us. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your post is completely irrelevant to these forums, and I have marked it as such. Please don't post such things here again.
Topic: Privacy & Security SubTopic: General Tags:
Dec ’24
Reply to I submitted app to review on app store and am getting crash on libswiftCore.dylib. When I compile and run code through Xcode everything works fine
Well, all I can see is that thread 10 crashed with an address size fault, so you might be trying to access something like an element of an array that isn't there, maybe you're trying to get array[10] in an array that has ten items, i.e. array[0...9]? Maybe you're force-unwrapping an optional? You're honestly just going to have to debug it. You have the code, we don't.
Dec ’24
Reply to iOs update camera and flash issue
You're in the wrong place. Also, "since they have updated"? Updated to what? Which version are you seeing this in? When you provide the relevant details, people can help, but just saying you have an issue doesn't help anyone. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. Thanks.
Dec ’24
Reply to APP login
Which app are you talking about? Which version of iOS are you talking about? And how does the input box "not work"? If this app is developed by a third-party - not Apple - then you should probably speak to the developer of that app, and not we random developers on here. We don't work for Apple, and it's also unlikely that the specific developer of whatever app you're talking about is on here reading your extremely vague post.
Replies
Boosts
Views
Activity
Dec ’24
Reply to cannot find in scope
Okay, well, you went ahead anyway. Here's my update: // ContentView.swift import SwiftUI struct ContentView: View { @State private var tipa: [Double] = [] @State private var costa: [Double] = [] @State private var cost = "" @State private var costt: Double? = 0.0 @State private var paidt: Double? = 0.0 @State private var paid = "" @State private var tipp = "" @State private var tipc = "" @State private var tipaa = "" @State private var totalCost = "" @State private var totalTips = "" @State private var totalCash = "" @State private var tipcc = "" @State private var numbc = "" @State private var deletep = 0 @State private var number = 0 @State private var errorMsg = "" var body: some View { GeometryReader { g in NavigationStack { VStack { HStack { // No need to manually pad the date out with spaces, which will never be correct. // Just use an HStack and put a Spacer() in, so it goes: |<.....Spacer().....>Date| Spacer() Text(Date().formatted(date: .numeric, time: .omitted)) .foregroundStyle(Color.black) .fontWeight(.bold) .padding(.trailing, 10) } Text("Driver's Food Delivery") .font(.largeTitle) .fontWeight(.bold) Image("Screenshot 2024") VStack { Spacer() Text(errorMsg) .foregroundStyle(Color.red) // Here, put the text in one Text element, and tell SwiftUI to put it on two lines. // No need for msg/msg2 variables. Text("Enter cost and how much was paid. Enter numbers and one decimal point only, then press Enter.") .foregroundStyle(Color.blue) .lineLimit(2, reservesSpace: true) Spacer() } // Use a Grid to lay out your data; much cleaner, and SwiftUI will keep it in columns for you Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Cost") .gridColumnAlignment(.leading) Text("Paid") .gridColumnAlignment(.leading) Text("Tip") .gridColumnAlignment(.trailing) Text("Tip %") .gridColumnAlignment(.trailing) } .font(.headline) GridRow { TextField("Cost", text: $cost) .padding(10) .background(Color.brown) .cornerRadius(12) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.leading) TextField("Paid", text: $paid) .padding(10) .background(Color.brown) .cornerRadius(12) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.leading) Text(tipp) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.trailing) Text(tipc) .frame(width: g.size.width * 0.2) .gridColumnAlignment(.trailing) } } .padding(.vertical, 20) HStack { Button { enterPayment() } label: { Text("Enter") .font(.title2) .padding(10) .background(Color.green) .foregroundStyle(Color.white) .cornerRadius(12) } .padding(.leading, 10) // Keeps it off the edge of the screen NavigationLink(destination: ViewDetail()) { Text("Detail") .font(.title2) .padding(10) .background(Color.blue) .foregroundStyle(Color.white) .cornerRadius(12) } Spacer() // Leaves a gap between the Enter & Detail buttons, and the destructive Delete button Button { delete(costa: &costa, tipa: &tipa, number: &number) } label: { Text("Delete") .font(.title2) .padding(10) .background(Color.red) .foregroundStyle(Color.white) .cornerRadius(12) } .padding(.trailing, 10) // Keeps it off the edge of the screen } Divider() // Nice little divider .padding(.vertical, 20) } VStack { Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Avg. Tip") .padding(.horizontal, 20) Text("Tip %") .padding(.horizontal, 20) Text("#") .padding(.horizontal, 20) } .gridColumnAlignment(.center) .font(.title3) GridRow { Text(tipaa) .padding(.horizontal, 20) Text(tipcc) .padding(.horizontal, 20) Text(numbc) .padding(.horizontal, 20) } .gridColumnAlignment(.center) .font(.system(size: 22, weight: .bold)) .foregroundStyle(Color.blue) } Spacer() } VStack { Grid(alignment: .center, horizontalSpacing: 6, verticalSpacing: 6) { GridRow { Text("Total Cost") .padding(.horizontal, 10) Text("Total Tips") .padding(.horizontal, 10) Text("Total Cash") .padding(.horizontal, 10) } .gridColumnAlignment(.center) .font(.title3) GridRow { Text(totalCost) .padding(.horizontal, 10) Text(totalTips) .padding(.horizontal, 10) Text(totalCash) .padding(.horizontal, 10) } .gridColumnAlignment(.center) .font(.system(size: 22, weight: .bold)) .foregroundStyle(Color.blue) } Spacer() } } } } func enterPayment() { var ttips = 0.0 var tcost = 0.0 var tipo = 0.00 costt = Double(cost) paidt = Double(paid) errorMsg = "" if(costt != nil && paidt != nil) { tipo = Double(paid)! - Double(cost)! tipa.append(tipo) costa.append(Double(cost)!) number += 1 numbc = String(number) ttips = (tipa.reduce(0, +)) tcost = (costa.reduce(0, +)) tipaa = (ttips / Double(number)).formatted(.currency(code: "USD")) totalTips = ttips.formatted(.currency(code: "USD")) totalCost = tcost.formatted(.currency(code: "USD")) tipp = tipo.formatted(.currency(code: "USD")) tipc = String(tipo / Double(cost)! * 100) tipc = String(format: "%3.0f%%", Double(tipc)!) tipcc = String(ttips / tcost * 100) tipcc = String(format: "%3.0f%%", Double(tipcc)!) totalCash = (tcost + ttips).formatted(.currency(code: "USD")) } else { errorMsg = "Enter numbers and 1 decimal point only." } } } struct ViewDetail: View { @State var text1: String = "" @State var tip1: String = "" @State var text23: String = "" @State var tip23: String = "" var body: some View { Text(text1) Text(tip1) Text(text23) Text(tip23) } func detailLine(costa: inout [Double], tipa: inout [Double]) { print(costa, tipa) text1 = "125" print("detail") } } func delete(costa: inout [Double], tipa: inout [Double], number: inout Int) { print(costa, tipa) tipa.removeLast() costa.removeLast() number -= 1 print(costa,tipa) } #Preview { ContentView() }
Replies
Boosts
Views
Activity
Dec ’24
Reply to cannot find in scope
Don't post the whole program. Aside from the fact it's far too much code and you'll end up posting it over numerous posts, you still haven't mastered the use of the code formatting tool so we won't be able to understand it anyway. Please just reduce your code to the smallest bit possible - remove any formatting that's unnecessary, like fonts and padding etc. - you can add it back later. As @Claude31 was saying, use a Binding to pass values from one View to another, something like this: struct ViewOne: View { @State private var firstNames: [String] = ["Dave", "Geoff", "Bob", "Charlie"] var body: some View { Text("Some text") ViewTwo(firstNames: $firstNames) } } struct ViewTwo: View { @Binding firstNames: [String] var body: some View { firstNames.forEach { name in Text("Current name = '\(name)'") } } } That should display this: Some text Current name = 'Dave' Current name = 'Geoff' Current name = 'Bob' Current name = 'Charlie'
Replies
Boosts
Views
Activity
Dec ’24
Reply to Sound not working on iPad 7th generation
You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums. You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them. We use these forums to ask for help on coding our apps; not for pointing out bugs in a beta version of the software. Please report bugs in the usual way.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Rooted iPhone 15 Pro
You're in the wrong place. This is nothing to do with us. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your post is completely irrelevant to these forums, and I have marked it as such. Please don't post such things here again.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to I submitted app to review on app store and am getting crash on libswiftCore.dylib. When I compile and run code through Xcode everything works fine
Well, all I can see is that thread 10 crashed with an address size fault, so you might be trying to access something like an element of an array that isn't there, maybe you're trying to get array[10] in an array that has ten items, i.e. array[0...9]? Maybe you're force-unwrapping an optional? You're honestly just going to have to debug it. You have the code, we don't.
Replies
Boosts
Views
Activity
Dec ’24
Reply to iOs update camera and flash issue
You're in the wrong place. Also, "since they have updated"? Updated to what? Which version are you seeing this in? When you provide the relevant details, people can help, but just saying you have an issue doesn't help anyone. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums. Thanks.
Replies
Boosts
Views
Activity
Dec ’24