Post

Replies

Boosts

Views

Activity

How to remove unused Help menu item from SwiftUI app
I've built a SwiftUI app which gives me a bonus Mac app. My app was rejected by the App Store because it has a help menu that doesn't actually function. The rejection said: "Specifically, the help tab will display an error. It would be appropriate to implement this feature or remove it from the binary." Does anyone know how to actually remove this from the binary? It's such a simple app, with a single function, so it really doesn't need a help item. Can't seem to find anything about this online.
5
0
4.5k
Jun ’20
Need to use Picker item as a value in a calculation
So, I've looked everywhere and battled with this for days with no luck. I've tried four of five different approaches with none of them working for me. In JavaScript I have no issue resolving my problem and I'm confident it's as simple but I'm just not that used to Swift as a language yet. How I've solved this in JavaScript before is to pick a value from the list by targeting it with .value so I wasn't sure if there was a similar option here. I have a WheelPicker in use to select a scale value by which the calculation needs to be multiplied. In order to conform to the requirements of the picker, this is an array of strings. I have a for loop that correctly iterates the array and populates. I also have a calculation that works with it, however, the calculation is multiplying by the 'index' of the array rather than the value itself. So for example, if the picker is on the default value, the entire calculation is multiplied by 0, and so on. I thought that by converting the String into a Double (I need decimal places) it'd resolve the issue, but the calculation still works via the index position. Any help would be greatly appreciated! You guys helped me solve another issue so I'm hopeful. Snippets below. Array @State private var scales = ["1.000", "1.067", "1.125", "1.200", "1.250", "1.333", "1.414", "1.500", "1.618"] Variable to make the picker work @State private var scaleSelector = 0 Calculation that takes in values and multiples by the scale (calculation works as expected without the Scale anyway) func pxToEms(pixelInt: Double, baseInt: Double, scales: Double) -> Double {   let emValue: Double = (pixelInt / baseInt) * scales             return emValue } Wheel picker for loop (just in case) Picker(selection: $scaleSelector, label: Text("Scale")) { ForEach(0 ..< scales.count) {    Text(self.scales[$0]).tag($0) &#9; } } .pickerStyle(WheelPickerStyle()) Where it renders in the UI Text("\(pixelText) Pixels is \(String(format: "%.3f", pxToEms(pixelInt: Double(pixelText) ?? 0, baseInt: Double(baseText) ?? 16, scales: Double(scaleSelector)))) Em")
5
0
1.5k
Jun ’20