Post

Replies

Boosts

Views

Activity

Reply to Digits move sideways
Monospaced is your best option. This makes a monospaced version of the current font struct ClockView: View {     @State private var date: String = "00:00:00"         var body: some View {             ZStack {                 Color.black                     .edgesIgnoringSafeArea(.all)                 Text(date)                     .foregroundColor(.white)                     .font(.system(size: 45, weight: .ultraLight, design: .default).monospaced())                     .foregroundColor(.secondary)                     .onReceive(ClockView.timer) { _ in                         self.date = ClockView.timeFormat.string(from: Date())                     }             }     }     static let timer = Timer.publish(every: 0.2, on: .main, in: .common).autoconnect()     static var timeFormat: DateFormatter {         let formatter = DateFormatter()         formatter.dateFormat = "HH:mm:ss"         return formatter } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to iOS 15.2 takes too long for calculations.
Then the worst case of your algorithm needs improvement. What does the calculation pattern look like? Is the input driven by data? How many dimensions or for loops process this data? Is my algorithm more efficient with small amounts of data but takes longer as the data get larger? Answer those questions then look for ways to improve any pattern that might be causing the issue. Iteration vs recursion, those types of questions. Now the question is if it's your API then think about how to improve it. If it is not yours then file a bug with the creator of the particular api.
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to Erasing strokes
A little bit of Set<> theory. When the draw state is set to erase (this behaviour will have to be modelled), do any current paths intercept any previously-stored paths if yes remove, place in a buffer (for undo purposes) and redraw. So instead of just drawing, you will need to model the behaviours.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to xCode Issue
This usually means you have an issue with thread safety, array bounds check error or a reference no longer exists. I will begin by performing NULL & array boundary checks on each array instance before accessing the subscripts.
Jan ’22