Post

Replies

Boosts

Views

Activity

Reply to Swipe gesture not updating VC?
Thanks, that worked! I knew it had to recompute somehow, but thought it was enough to just use the updateHorse() function. I ended up putting the recalculation at the end of the IBAction to keep it clean         if horseIndex < horseNumber {             horseIndex -= 1         }         if horseIndex == horseNumber {             horseIndex -= 1         }         if horseIndex == -1 {             horseIndex = horseNumber         }                  currentHorse = myHorses[horseIndex]         updateHorse()     }
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’20
Reply to Segue to Tabbed view controller crashes
Thanks for the clarification. I get the following: 2020-10-14 07:17:12.602493+0200 Tobiano[11289:1183798] [Storyboard] Unknown class HorseSettingsViewController in Interface Builder file. [<UIViewController: 0x7f80c9c21f30>, <UIViewController: 0x7f80c9d0b080>, <Tobiano.FeedPlanViewController: 0x7f80cb023800>, <Tobiano.TrainingViewController: 0x7f80c9f0bbf0>, <Tobiano.HorseViewController: 0x7f80cb016c00>] Could not cast value of type 'UIViewController' (0x7fff86e8caf8) to 'Tobiano.HorseViewController' (0x10eb13190). 2020-10-14 07:17:12.610662+0200 Tobiano[11289:1183798] Could not cast value of type 'UIViewController' (0x7fff86e8caf8) to 'Tobiano.HorseViewController' (0x10eb13190). Could not cast value of type 'UIViewController' (0x7fff86e8caf8) to 'Tobiano.HorseViewController' (0x10eb13190). CoreSimulator 732.17 - Device: iPhone 11 (A0DE279E-03DD-489A-BD23-29C452150AB1) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’20
Reply to Segue to Tabbed view controller crashes
Yeah, it makes more sense to ask it to search for a UITabBarController :) How do I find the index for kIndexHorseViewController? For now, I tested it with "1" as the index and it crashed with the same error at let horseVC = tabBarVC.viewControllers![kIndexHorseViewController] as! HorseViewController
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’20
Reply to Problems using classes for reusable headers
I did a clean build folder, but still getting this error: Thread 1: "[<UIView 0x7fb6b0d119b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key headerText." I tried commenting out the bit where I change the headerText and the outlet for the header without result. Also checked for broken connections in the view controller. It's underlining AppDelegate in the error text with the same error. There is still a headerText outlet in HeaderView.swift. This isn't connected to anything since I changed the class of the HeaderView.xib, I can't see the file in assistant anymore so I deleted the connection. Still getting the same error
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’20
Reply to Problems with randomisation when appending to an array
I think I solved the issue. I added an ID number to each new horse, making all the names unique. Now each new horse is random and also has an ID number. I made a property : var horsesCreated = 2 then each new horse got the property idNumber: (horsesCreated+1) and the buyHorseButton is assigned to do this after creating a horse; horsesCreated += 1 I know this maybe isn't the cleanest fix, but I am really happy it's working. Couldn't have done it without your input! Thanks for your patience :)
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’20