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
Reply to Do I need to test when publishing an application
Do I need to go through a testing process Yes, of course. And remind your app will not pass review if reviewer finds a bug. But precise answer may depend on what you mean. You need to test extensively: that means testing all the functions of your app in various conditions: for instance, if user has to enter a value, test with different values including "incorrect" values. Test also the performance if that is important for your app. If you write a user manual, that's a good way to be sure you test in a user perspective, not only a developer one. But you are not required to go through a specific test method or process. It is up to you to select the best, possibly some tool to organise test. You may have a look here: https://useyourloaf.com/blog/xcode-test-plans/ https://www.avanderlee.com/swift-testing/introducing-expressive-apis/
Nov ’24
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:
Replies
Boosts
Views
Activity
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.
Replies
Boosts
Views
Activity
Nov ’24
Reply to App behavior changed under Sequoia 15.1.
Unfortunately, I can't tell if anything changed. But if you ask each subview to be visible, do you get them ? Or try (I did not test) to makeKeyAndOrderFront, with something like: theWindow.subview1.makeKeyAndOrderFront(theWindow.subview1)
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
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
Replies
Boosts
Views
Activity
Nov ’24
Reply to Do I need to test when publishing an application
Do I need to go through a testing process Yes, of course. And remind your app will not pass review if reviewer finds a bug. But precise answer may depend on what you mean. You need to test extensively: that means testing all the functions of your app in various conditions: for instance, if user has to enter a value, test with different values including "incorrect" values. Test also the performance if that is important for your app. If you write a user manual, that's a good way to be sure you test in a user perspective, not only a developer one. But you are not required to go through a specific test method or process. It is up to you to select the best, possibly some tool to organise test. You may have a look here: https://useyourloaf.com/blog/xcode-test-plans/ https://www.avanderlee.com/swift-testing/introducing-expressive-apis/
Replies
Boosts
Views
Activity
Nov ’24