Post

Replies

Boosts

Views

Activity

Reply to I don’t think the math is mathing. How is this possible?
This is a question about an existing app (you don't tell which unfortunately), not for an app development. So this forum is not the right place to post the question.   is there a way to fix this? You should ask on the app's developer forum. For some reason, the app has registered a total screen time of 139h05'. But only a small part falling in one of the categories. Hence, an average oh 19h52' per day (math is exact). It is up to you to understand how total screen time is accounted depending on the settings you may have defined.
Dec ’24
Reply to Updating EditButton
This thread may provide some hints: https://www.hackingwithswift.com/forums/swiftui/list-view-stuck-in-edit-mode/7401 It tested this, which apparently does what you need: struct ContentView: View { @State private var selects: Set<Int> = [] @State var range = [1, 2, 3 ,4, 5] @Environment(\.editMode) var editMode var body: some View { VStack{ EditButton() List(selection: $selects){ ForEach(range, id: \.self) { ItemInList(num: $0) } .onDelete { range.remove(atOffsets: $0) editMode?.wrappedValue = .inactive } } .listStyle(PlainListStyle()) } } }
Dec ’24
Reply to On a brand new build, why would I get this error: "Error creating the CFMessagePort needed to communicate with PPT."
I get the same message in log when creating a project in Xcode 16.2 on MacMini with MacOS 14.7.2. Error creating the CFMessagePort needed to communicate with PPT. Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics I tested on Xcode 15.3 creating a new project does not show the log but another one: Logging Error: Failed to initialize logging system. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables. opening the project created with 16.2 crashed Xcode, even after changing project format to Xcode 15.3 from 16.0. As the Xcode 16,2 project works without problem, that seems to be just log noise. You could file a bug report however.
Topic: UI Frameworks SubTopic: SwiftUI
Dec ’24
Reply to textfield does not allow any user input
Why do you need to create a new UITextField in the IBAction ? You recreate a new UITextField which hides the existing one, hence you cannot enter anything). The logical way to do it: create the UITextField in the storyboard (I understand you did it) connect to an IBOutlet that you name nameTextField declare the placeholder in the storyboard (attributes inspector). It will be displayed automatically when the textField is empty. do not create the IBAction yet Then you should be able to type in nameTextField If you need an IBAction (but do NOT create nameTextField subview inside) declare in storyboard that the delegate of the textField is the UIViewController declare that the UIViewController conforms to UITextFieldDelegate change the IBAction (if you need to have some action once text entered) by: @IBAction func insertName(_ sender: UITextField) { let enteredName = sender.text print("Entered Name:", enteredName ?? "") } What is the error message on line 13 ?
Topic: UI Frameworks SubTopic: UIKit
Dec ’24
Reply to Stuck using variable in the tex statement
If I am honest this bit of code was generated, after a lot of trial and error by ChatBT. That's a problem when you don't understand the code you use. Did you ask CGT to solve the issue, as they proposed the code ? 😉 Returning to human answer, you didn't answer my question. Did you test the code I sent you? What is the result ?
Dec ’24
Reply to Stuck using variable in the tex statement
Could you test: case rule.hasSuffix("wins."): // "Player to reach X wins." let topScorers = scores.filter { $0.1 >= target } if !topScorers.isEmpty { print("topScorers not Empty") // <<-- ADD THIS let maxScore = scores.max(by: { $0.1 < $1.1 })?.1 ?? 0 let topScorers2 = scores.filter { $0.1 == maxScore } // <<-- CHANGE to topScorers2 gameIsDraw = topScorers2.count > 1 winner = topScorers2.count == 1 ? topScorers2.first?.0 : nil And tell what you get. A comment. Even if the syntax is correct, let maxScore = scores.max(by: { $0.1 < $1.1 })?.1 ?? 0 is hard to read. .1 is a property, it would be so easier to read by using the property name
Dec ’24
Reply to UIViewRepresentable is not working
I tested this part of code, with no error, as long as you include the updateUIView function, even empty. struct WebViewContainerRepresentable: UIViewRepresentable { typealias UIViewType = WKWebView func makeUIView(context: Context) -> WKWebView { let webView = WKWebView() if let url = Bundle.main.url(forResource: "index", withExtension: "html") { webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent()) } return webView } func updateUIView(_ uiView: WKWebView, context: Context) { // Updates not required for this use case } }
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24
Reply to Stuck using variable in the tex statement
So that means winner is nil. There is likely an error here: gameIsDraw = topScorers.count > 1 winner = topScorers.count == 1 ? topScorers.first?.0 : nil gameIsDraw is true if count > 1 But winner is defined when count == 1 It should probably be winner = topScorers.count >= 1 ? topScorers.first?.0 : nil
Dec ’24
Reply to array
So, you will pass the array populated with the prices (in fact, you probably need to pass more information, to know to which pizza or customer a price refers to). Is it for SwiftUI or UIKit ? for SwiftUI, you would have a State var with the costs (or more info) and could use List to display @State var costs: [Double] = [] // You will have to append this array when you add a pizza In the body of the View, something like: struct ContentView: View { @State var costs: [Double] = [] // You will have to append this array when you add a pizza @State var newCost: Double = 0 var body: some View { VStack { List(costs, id: \.self) { cost in Text("cost: \(String(format: "%4.2f", cost) )") } HStack { Text("New pizza cost") TextField("", value: $newCost, format: .number) .border(.blue) } Button(action: { if newCost > 0 { self.costs.append(newCost) } newCost = 0 }) { Text("Append") } Spacer() } } }
Dec ’24
Reply to array
I'm not sure to understand. With the present code: func myfunc(costa: [Double]) { } myfunc(costa:[ ]) calling with [] parameter of course uses an empty array. If you call func myfunc(costa: [Double]) { print(costa.count) } myfunc(costa:[ 10.0, 20.0]) It will not be empty. You will see in log it has 2 items. But is it what you want ? What do you do in myfunc ? Just use the array (as in the example above) ? Or add items to the array ?
Dec ’24
Reply to Seeking advice on why Dog Translator Game for Dogs violates guideline 1.1.6 Safety: Objectionable Content
Including the "game" word and a notice that it is for entertainment only is not enough according to guideline 1.1.6 False information and features, including inaccurate device data or trick/joke functionality, such as fake location trackers. Stating that the app is “for entertainment purposes” won’t overcome this guideline. My understanding is that reviewer considers that some people will think they are able to speak to their dog. That's what your app name suggests with "Translator" and that could mislead users into thinking they will be able to "speak" dog. No one can give sure advice to pass review, but… At least, you could rename completely the app, eliminating the translator word. May be something like "Barking like a dog" or "Barking" ? would be more acceptable. And check that your app cannot be understood as a way to speak to a dog. Even the icon should take care of this, as well as all textes and images in the app. Good luck.
Dec ’24
Reply to I don’t think the math is mathing. How is this possible?
This is a question about an existing app (you don't tell which unfortunately), not for an app development. So this forum is not the right place to post the question.   is there a way to fix this? You should ask on the app's developer forum. For some reason, the app has registered a total screen time of 139h05'. But only a small part falling in one of the categories. Hence, an average oh 19h52' per day (math is exact). It is up to you to understand how total screen time is accounted depending on the settings you may have defined.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Feedback Assistant: „This Feedback will no longer be monitored, and incoming messages will not be reviewed.“
I do fear that some of those messages are automatically generated. making the dialog useless. May be someone from the FB Assistant can confirm or infirm my guess ?
Replies
Boosts
Views
Activity
Dec ’24
Reply to Only 'Users and Access' Visible on App Store Connect – Apps Not Showing
The only time I got a similar problem was because I was registered on several accounts and had not the required credentials for the account I was connecting to. This is selected in the right hand corner of appStoreConnect page.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Updating EditButton
This thread may provide some hints: https://www.hackingwithswift.com/forums/swiftui/list-view-stuck-in-edit-mode/7401 It tested this, which apparently does what you need: struct ContentView: View { @State private var selects: Set<Int> = [] @State var range = [1, 2, 3 ,4, 5] @Environment(\.editMode) var editMode var body: some View { VStack{ EditButton() List(selection: $selects){ ForEach(range, id: \.self) { ItemInList(num: $0) } .onDelete { range.remove(atOffsets: $0) editMode?.wrappedValue = .inactive } } .listStyle(PlainListStyle()) } } }
Replies
Boosts
Views
Activity
Dec ’24
Reply to Trouble Seeing print debug statements
Welcome to the forum. Sorry for the trivial check. Are you sure the log panel (right one) is on display ?
Replies
Boosts
Views
Activity
Dec ’24
Reply to On a brand new build, why would I get this error: "Error creating the CFMessagePort needed to communicate with PPT."
I get the same message in log when creating a project in Xcode 16.2 on MacMini with MacOS 14.7.2. Error creating the CFMessagePort needed to communicate with PPT. Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics I tested on Xcode 15.3 creating a new project does not show the log but another one: Logging Error: Failed to initialize logging system. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables. opening the project created with 16.2 crashed Xcode, even after changing project format to Xcode 15.3 from 16.0. As the Xcode 16,2 project works without problem, that seems to be just log noise. You could file a bug report however.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Dec ’24
Reply to textfield does not allow any user input
Why do you need to create a new UITextField in the IBAction ? You recreate a new UITextField which hides the existing one, hence you cannot enter anything). The logical way to do it: create the UITextField in the storyboard (I understand you did it) connect to an IBOutlet that you name nameTextField declare the placeholder in the storyboard (attributes inspector). It will be displayed automatically when the textField is empty. do not create the IBAction yet Then you should be able to type in nameTextField If you need an IBAction (but do NOT create nameTextField subview inside) declare in storyboard that the delegate of the textField is the UIViewController declare that the UIViewController conforms to UITextFieldDelegate change the IBAction (if you need to have some action once text entered) by: @IBAction func insertName(_ sender: UITextField) { let enteredName = sender.text print("Entered Name:", enteredName ?? "") } What is the error message on line 13 ?
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Dec ’24
Reply to Stuck using variable in the tex statement
If I am honest this bit of code was generated, after a lot of trial and error by ChatBT. That's a problem when you don't understand the code you use. Did you ask CGT to solve the issue, as they proposed the code ? 😉 Returning to human answer, you didn't answer my question. Did you test the code I sent you? What is the result ?
Replies
Boosts
Views
Activity
Dec ’24
Reply to Stuck using variable in the tex statement
Could you test: case rule.hasSuffix("wins."): // "Player to reach X wins." let topScorers = scores.filter { $0.1 >= target } if !topScorers.isEmpty { print("topScorers not Empty") // <<-- ADD THIS let maxScore = scores.max(by: { $0.1 < $1.1 })?.1 ?? 0 let topScorers2 = scores.filter { $0.1 == maxScore } // <<-- CHANGE to topScorers2 gameIsDraw = topScorers2.count > 1 winner = topScorers2.count == 1 ? topScorers2.first?.0 : nil And tell what you get. A comment. Even if the syntax is correct, let maxScore = scores.max(by: { $0.1 < $1.1 })?.1 ?? 0 is hard to read. .1 is a property, it would be so easier to read by using the property name
Replies
Boosts
Views
Activity
Dec ’24
Reply to UIViewRepresentable is not working
I tested this part of code, with no error, as long as you include the updateUIView function, even empty. struct WebViewContainerRepresentable: UIViewRepresentable { typealias UIViewType = WKWebView func makeUIView(context: Context) -> WKWebView { let webView = WKWebView() if let url = Bundle.main.url(forResource: "index", withExtension: "html") { webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent()) } return webView } func updateUIView(_ uiView: WKWebView, context: Context) { // Updates not required for this use case } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Stuck using variable in the tex statement
I do think winner is nil. Where do you call the case rule… are called. Are you sure they are ever called ? Please show complete code to allow for testing.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Stuck using variable in the tex statement
So that means winner is nil. There is likely an error here: gameIsDraw = topScorers.count > 1 winner = topScorers.count == 1 ? topScorers.first?.0 : nil gameIsDraw is true if count > 1 But winner is defined when count == 1 It should probably be winner = topScorers.count >= 1 ? topScorers.first?.0 : nil
Replies
Boosts
Views
Activity
Dec ’24
Reply to array
So, you will pass the array populated with the prices (in fact, you probably need to pass more information, to know to which pizza or customer a price refers to). Is it for SwiftUI or UIKit ? for SwiftUI, you would have a State var with the costs (or more info) and could use List to display @State var costs: [Double] = [] // You will have to append this array when you add a pizza In the body of the View, something like: struct ContentView: View { @State var costs: [Double] = [] // You will have to append this array when you add a pizza @State var newCost: Double = 0 var body: some View { VStack { List(costs, id: \.self) { cost in Text("cost: \(String(format: "%4.2f", cost) )") } HStack { Text("New pizza cost") TextField("", value: $newCost, format: .number) .border(.blue) } Button(action: { if newCost > 0 { self.costs.append(newCost) } newCost = 0 }) { Text("Append") } Spacer() } } }
Replies
Boosts
Views
Activity
Dec ’24
Reply to array
I'm not sure to understand. With the present code: func myfunc(costa: [Double]) { } myfunc(costa:[ ]) calling with [] parameter of course uses an empty array. If you call func myfunc(costa: [Double]) { print(costa.count) } myfunc(costa:[ 10.0, 20.0]) It will not be empty. You will see in log it has 2 items. But is it what you want ? What do you do in myfunc ? Just use the array (as in the example above) ? Or add items to the array ?
Replies
Boosts
Views
Activity
Dec ’24
Reply to Seeking advice on why Dog Translator Game for Dogs violates guideline 1.1.6 Safety: Objectionable Content
Including the "game" word and a notice that it is for entertainment only is not enough according to guideline 1.1.6 False information and features, including inaccurate device data or trick/joke functionality, such as fake location trackers. Stating that the app is “for entertainment purposes” won’t overcome this guideline. My understanding is that reviewer considers that some people will think they are able to speak to their dog. That's what your app name suggests with "Translator" and that could mislead users into thinking they will be able to "speak" dog. No one can give sure advice to pass review, but… At least, you could rename completely the app, eliminating the translator word. May be something like "Barking like a dog" or "Barking" ? would be more acceptable. And check that your app cannot be understood as a way to speak to a dog. Even the icon should take care of this, as well as all textes and images in the app. Good luck.
Replies
Boosts
Views
Activity
Dec ’24