Post

Replies

Boosts

Views

Activity

Progress bar issues
Hi, I am developing a MacOS app for the Mac App Store using AppleScript. It was rejected because the Stop button of one of the progress bars did not produce any action when clicked (or, at least it didn't for over 5 minutes). I have a theory for why this happened: The app was in the middle of executing a shell command while the progress bar was showing, so the application was unresponsive and thus not responsive to user clicks. But this doesn't help me solve the issue. If the app is not responsive at that time, how do I make the app close when the "Stop" button is clicked? I want the whole app to close quickly when Stop is pressed. Another thing that further complicates this issue is that everything is wrapped in try-catch blocks. When a user cancels something in AppleScript (such as by pressing a Stop button in a progress bar), an error is thrown to signal that the script must stop. If the user clicks "Stop" in the middle of a try-catch block, the script will not cancel-it will execute whatever I tell it to do on an error. There are too many try blocks in the app to put in a check for what error occurred in each one. So, how do I make the script respond quickly and produce the desired action (closing the app) in under 5 minutes?
6
0
1.8k
May ’21
Class with properties of custom types into UserDefaults
Hi, I am making an iOS video game and want to save the player's data. Is it possible to save an instance of this class into UserDefaults? The class in question has properties that reference other custom classes. This is my class definition: class Warrior: CombatEligible {   var name: String = ""   var gender: String = ""   var level: Int = 1   var xp: Int = 0   var current_dimension: VirtualDimension = Master_Nexus   var gold: Int = 0   var weapons: [String] = []   var completed_dimensions: [VirtualDimension] = []   var hp: Int = 10   var items: [Item] = []   var knocked_out: Bool = false   var pet: Monster = myPet   var warrior_created = false   var defeated_monsters: Int = 0   var currentTarget: Monster = no_monster   var maxWeight: Int = 0   var defeated_bosses: Int = 0   var inCombat: Bool = checkCombat()   var targetIsInvisible: Bool = false   var inBossBattle: MultipleValues = [false, no_boss]   var invisible: Bool = false   var hypnotized: Bool = false   var switchingEnabled: Bool = true   var switchedToPet: Bool = false   var stunned: Bool = false   var errodable_target_weakened: Bool = false   var errodable_target_weakened_target: Monster = no_monster   var currentWeapon: Weapon? } The class has properties that are instances of other classes for example: var pet: Monster = myPet (myPet is an instance of the Monster class). Therefore, Warrior cannot conform to the Codable protocol and cannot be saved to UserDefaults. What do I do?
3
0
350
Feb ’22
Progress bar issues
Hi, I am developing a MacOS app for the Mac App Store using AppleScript. It was rejected because the Stop button of one of the progress bars did not produce any action when clicked (or, at least it didn't for over 5 minutes). I have a theory for why this happened: The app was in the middle of executing a shell command while the progress bar was showing, so the application was unresponsive and thus not responsive to user clicks. But this doesn't help me solve the issue. If the app is not responsive at that time, how do I make the app close when the "Stop" button is clicked? I want the whole app to close quickly when Stop is pressed. Another thing that further complicates this issue is that everything is wrapped in try-catch blocks. When a user cancels something in AppleScript (such as by pressing a Stop button in a progress bar), an error is thrown to signal that the script must stop. If the user clicks "Stop" in the middle of a try-catch block, the script will not cancel-it will execute whatever I tell it to do on an error. There are too many try blocks in the app to put in a check for what error occurred in each one. So, how do I make the script respond quickly and produce the desired action (closing the app) in under 5 minutes?
Replies
6
Boosts
0
Views
1.8k
Activity
May ’21
Class with properties of custom types into UserDefaults
Hi, I am making an iOS video game and want to save the player's data. Is it possible to save an instance of this class into UserDefaults? The class in question has properties that reference other custom classes. This is my class definition: class Warrior: CombatEligible {   var name: String = ""   var gender: String = ""   var level: Int = 1   var xp: Int = 0   var current_dimension: VirtualDimension = Master_Nexus   var gold: Int = 0   var weapons: [String] = []   var completed_dimensions: [VirtualDimension] = []   var hp: Int = 10   var items: [Item] = []   var knocked_out: Bool = false   var pet: Monster = myPet   var warrior_created = false   var defeated_monsters: Int = 0   var currentTarget: Monster = no_monster   var maxWeight: Int = 0   var defeated_bosses: Int = 0   var inCombat: Bool = checkCombat()   var targetIsInvisible: Bool = false   var inBossBattle: MultipleValues = [false, no_boss]   var invisible: Bool = false   var hypnotized: Bool = false   var switchingEnabled: Bool = true   var switchedToPet: Bool = false   var stunned: Bool = false   var errodable_target_weakened: Bool = false   var errodable_target_weakened_target: Monster = no_monster   var currentWeapon: Weapon? } The class has properties that are instances of other classes for example: var pet: Monster = myPet (myPet is an instance of the Monster class). Therefore, Warrior cannot conform to the Codable protocol and cannot be saved to UserDefaults. What do I do?
Replies
3
Boosts
0
Views
350
Activity
Feb ’22