Post

Replies

Boosts

Views

Activity

Reply to App Intent not Discoverable by Siri
just say "Show me my books". don't need your app name. Also it seems you don't need the AppShortcutsProvider. I was able to get it working with just the AppIntent struct struct ShowMeMyBooks: AppIntent {     static var title: LocalizedStringResource = "Show me my books"     @MainActor     func perform() async throws -> some IntentResult {         return .result(dialog: "These are your books")     }     static var openAppWhenRun: Bool = false } note: it seems the sample code in the WWDC session is wrong. its right in the video but not in the attached code.
Jul ’22
Reply to Charts: customising chartYAxis values
a .stride solution based on Olivers suggestion: func myChart() -> some View {         var yAxisMaxValue = 23532 //get the min and max values from your data         var yAxisMinValue = -7633 //get the min and max values from your data         let roundedYAxisMaxValue = roundUp(yAxisMaxValue, to: 2)         let roundedYAxisMinValue = roundUp(yAxisMinValue, to: 2)         let strideValue = max(abs(roundedYAxisMaxValue), abs(roundedYAxisMinValue)) / 3.0 //max 3 axis marks above and max 3 below zero return Chart { //your chart layout code } .chartYAxis {             AxisMarks(values: .stride(by: strideValue)) {                 let value = $0.as(Double.self)!                 AxisGridLine()                 AxisTick()                 AxisValueLabel {                     Text("\(self.abbreviateAxisValue(string: "\(value)"))")                 }             }         } } func abbreviateAxisValue(string: String) -> String {         let decimal = Decimal(string: string)         if decimal == nil {             return string         } else {             if abs(decimal!) > 1000000000000.0 {                 return "\(decimal! / 1000000000000.0)t"             } else if abs(decimal!) > 1000000000.0 {                 return "\(decimal! / 1000000000.0)b"             } else if abs(decimal!) > 1000000.0 {                 return "\(decimal! / 1000000.0)m"             } else if abs(decimal!) > 1000.0 {                 return "\(decimal! / 1000.0)k"             } else {                 return "\(decimal!)"             }         } } //round up to x significant digits func roundUp(_ num: Double, to places: Int) -> Double {         let p = log10(abs(num))         let f = pow(10, p.rounded(.up) - Double(places) + 1)         let rnum = (num / f).rounded(.up) * f         return rnum     }
Jun ’22
Reply to Macbook too old.
What I used to do when I was in your situation was to create a VMware image with a macOS install and Xcode and put it on a large thumbdrive. Then go to a public library with Macs and run the virtual machine and code using that. I did that until I could afford a macbook. I can't remember exactly how I got it to run but might be worth researching if u have access to a library or other public facility with newer Macs. not sure if u even need a Mac, maybe just a fast machine. also have a browse of eBay or whatever classified site u have where u live. you can probably pick up an old (but newer Mac than yours) for $50 or even free. though sounds like a **** move from whoever at apple you were talking to.
Jun ’22
Reply to Charts: customising chartYAxis values
This is absolutely the wrong way to do it - It relies on debug descriptions - but until we find another solution, this will work: .chartYAxis {       AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                         Text("\(abbreviateAxisValue(string: self.parseAxisValue(value: value) ?? ""))")            }      } } func parseAxisValue(value: AxisValue) -> String? {         let input = String(describing: value)         let regex = /\((\d*.0)|\((0)|\((-\d*.0)/         if let match = input.firstMatch(of: regex) {             return "\(match.1 ?? match.2 ?? match.3 ?? "")"         }         return nil     } func abbreviateAxisValue(string: String) -> String {         let decimal = Decimal(string: string)         if decimal == nil {             return string         } else {             if abs(decimal!) > 1000000000000.0 {                 return "\(decimal! / 1000000000000.0)t"             } else if abs(decimal!) > 1000000000.0 {                 return "\(decimal! / 1000000000.0)b"             } else if abs(decimal!) > 1000000.0 {                 return "\(decimal! / 1000000.0)m"             } else if abs(decimal!) > 1000.0 {                 return "\(decimal! / 1000.0)k"             } else {                 return "\(decimal!)"             }         } }
Jun ’22