Post

Replies

Boosts

Views

Activity

Reply to How to break `while` loop and `deliver partial result to `View`?
You don't show how the view uses the result. That should help. I would do it with recursively calling iteration steps. In the View, as an action for a button, call simulation() This function is defined as func simulation() { let numberOfStep = 100000 // any very large number runSimulation(in: stopped.atStep..<numberOfStep) } The trick is that in runSimulation(), you call calls it recursively func runSimulation<T: Sequence>(in sequence: T) where T.Element == Int { // execute one step of the loop runSimulation(in: sequence.dropFirst()) // call recursively } stopped is a state var @State var stopped : (on: Bool, atStep: Int) = (on: false, atStep: 0) atStep is the value (loop index) at which you may have stopped with another button action in the view, which let's you resume where you stopped if you want with a resume button. Note that in your case, you could do it by chunks of 100 steps instead of individual steps, so the number of steps would be 1000 instead of 100000 for instance. Much more detailed explanation here: https://stackoverflow.com/questions/64202210/dispatchqueue-main-asyncafter-not-delaying Hope that helps.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’24
Reply to Looking for suggestions on writing a spreadsheet type app
The UI part is essential. I remember in the old ages the Jazz spreadsheet on Mac was a complete mess, because it did not exploit the Mac UI capabilities. Where Excel did it excellently. I understand it is for your personal use ? A full fledge spreadsheet is a huge endeavour. Beyond an individual capability (specially if you're a beginner on Mac development), unless you limit yourself very strictly (aka VisiCalc if you remember, plus some specific capabilities to handle functions you think of). As for the language, I would suggest Swift.
Nov ’24
Reply to question about error
As explained here, https://stackoverflow.com/questions/58081108/unexpected-character-in-prerequisites you may have a colon (:) in a name of a file or directory. Or leading spaces. In any case, a name is invalid for Xcode. You should find and remove. Hope that helps.
Topic: UI Frameworks SubTopic: SwiftUI
Nov ’24