Post

Replies

Boosts

Views

Activity

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 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 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 Separating CoreData functionality from the View (SwiftUI) but Still with observability
@DelawareMathGuy this is what I had to do to trigger the FRCDelegate but this goes against the FRC automatically doing it after the performFetch fetchedResultsController?                 .publisher(for: \.fetchedObjects)                 .receive(on: OperationQueue.main)                 .sink(receiveValue: { [weak self] data in                     guard let self = self,                             let data = data else { return }                     for (index, object) in data.enumerated() {                         let indexpath = IndexPath(item: index, section: 0)                         if let controller = self.fetchedResultsController as? NSFetchedResultsController<NSFetchRequestResult> {                             self.controller(controller, didChange: object,                                             at: nil,                                             for: .insert,                                             newIndexPath: indexpath)                         }                     }                 }).store(in: &cancellables)
Jan ’22
Reply to Socket - web server problems
Who wrote the webserver? What compiler tools did you use to write the webserver? Who is sending the packets to the clients? Is your handcrafted webserver following all of the RFC-based specs? Was the webserver written with Xcode, does it run on the mac or any Apple mobile products? In this scenario, your web server is sending data in response to a client, not the other way around other than a get URL request.
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to How to have the square (logo only) Apple sign in button.
Button(action: {}) {                 ZStack {                     RoundedRectangle(cornerRadius: 16)                         .fill(.gray)                     Image(systemName: "applelogo")                         .resizable()                         .padding(2.0)                 }             }             .frame(width: 120.0, height: 120.0)
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to Simulator stuck on white screen? (Django + Xcode)
This is most likely failing because you're ignoring failures on a non ssl http endpoint: read here if let response = try? JSONDecoder().decode([Account].self, from: data) {    DispatchQueue.main.async {              self.accounts = response     } } else { // add logic to handle api errors here }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22