Post

Replies

Boosts

Views

Activity

Charts: customising chartYAxis values
anyone figured out how to customise the Y axis values? id like to be able to process the. axis values and. then display them in the. format id like. eg. "1000" I'd like to display as "1k" the furthest Ive been able to get is to get the axis to display a static text as the number ie "Y" in the code below. but I haven't been able to access the value. in the code below 'value' seems to be an AxisValue which stores the value but I can't seem to access it in a format I can process. .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                     Text("Y")                     }                 }             } id like to be able to do something like this: .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                         if value > 1000000000000.0 {                             Text("\(value / 1000000000000.0)t")                         } else if value > 1000000000.0 {                             Text("\(value / 1000000000.0)b")                         } else if value > 1000000.0 {                             Text("\(value / 1000000.0)m")                         } else if value > 1000.0 {                             Text("\(value / 1000.0)k")                         }                     }                 }             }
5
2
5.2k
Jun ’22
Xcode iOS15 beta 2 .tag in ForEach doesn't compile
in Xcode iOs15 beta 2 the .tag modifier in a ForEach statement gives the following compile error "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" the error shows up on the .navigationBarTitle line but its due to the .tag line works fine on all previous releases. anyone know how to fix? code example below func content() -> some View {         let rentFrequencies = RentFrequency.allCases         return List {             ForEach(rentFrequencies, id: \.self) { rentFrequency in                 if rentFrequency != RentFrequency.NoFrequency {                     HStack() { Text(rentFrequency.name).tag(rentFrequency.id) // Including this tag makes it not compile                         if rentFrequency == type {                             Spacer()                             Image(systemName: "checkmark") .foregroundColor(.accentColor)                         }                     }                     .onTapGestureForced(perform: { self.type = rentFrequency })                     .frame(width: nil, height: 32.0)                 }             }         } .listStyle(InsetGroupedListStyle())         .navigationBarTitle("Rent Frequency")     }
0
0
953
Jun ’21
is there a demo app for the "Add configuration and intelligence to your widgets" WWDC session
is there a demo app for the "Add configuration and intelligence to your widgets" WWDC2020 session? Xcode doesn't autogenerate any of the code that the demo says it will and parts of the code show in the video is cut off on the screen so I can't see what the code is. keen to get the app so I can manually copy it in. also the written instructions at https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget seem to miss parts out as Xcode doesn't generate the code that the instructions say it will. a demo app for that will also be helpful
5
0
1.6k
Sep ’20