Thanks for you reply!
I am already using a ColorSet with a light and a dark color but the border doesn't change its color when I change the theme. It's working fine for everything else but stuff that I set through the "Identity Inspector" in storyboard (I don't set it through code) doesn't seem to be affected.
I also tried setting the button to a custom class SpecialButton:UIButton {} with the traitCollectionDidChange code (which was suggested on stackexchange) and then it's working but at the same time it's not affecting every button, unless I actively set them to use that class. :/ I'd rather have this as default behavior, like with the extension.
Post
Replies
Boosts
Views
Activity
I just noticed: Even if I set the border color in code with myButton.layer.borderColor = UIColor(named: "ButtonBorderColor")!.cgColor, it doesn't update unless I reload the UIViewController. It looks like you do have to use an additional function (like traitCollectionDidChange) that is called automatically when the theme changes.
Thanks for your reply! This option also exists in Xcode 12.5, which is the version I'm using. I've got basically no experience with regex, what do I have to use to find the active prints?
Sorry, forgot to mention, I've currently got version 12.5.
No, instead of "15:56", like in your screenshot, it says "Null". Even when Xcode doesn't crash instantly, then it does when I double-click to edit it. The usual stuff, like cleaning the build folder or restarting Xcode doesn't help either.
60gb? That better be a joke. My mac's only got 128gb and with a minimum of apps and stuff like Garage Band already uninstalled the maximum free space I see occasionally is around 40gb. It's currently downloading the new OS version, so hopefully that'll clear same space but that requirement is just ridiculous, especially since you can't just exchange the drive for a bigger one.
Thanks for the suggestion, fortunately I was able to use a slightly older version of the storyboard file that I'm able to open but if it happens again, then I can test it.
Sorry, forgot to tag you. I posted my reply below.
Atm it's set up to download every file in a folder. First I get the folder content as a list, then I loop through all the files and download them. At the beginning of each loop iteration the file name is taken from the list and I want to somehow pass it back to the main/UI thread, so I can display an alert with an info what file is currently being downloaded. So: 1. Create alert, 2. Switch to background thread (see function above), 3. Get list, 4. Get file name, 5. Update alert with file name, 6. Download file, 7. Repeat 4.-6. until all files are downloaded, 8. Switch back to main thread (see function above) and do more stuff (including hiding the alert again) but only when everything's done.
Thanks for you reply. I know what the error means but it shouldn't be thrown because the UIColor exists, that's the problem. I used the same code before I updated to Xcode 13 and everything was fine then. Yes, I did create the color in Assets, it's a regular color set, like the other 10+ I'm using in my app. All of these other color sets work fine, it's only this one in this specific function/class. I did already add a print similar to yours (something that checks for nil) but it was never printed to console, probably because I never changed the theme, even though the overall error still showed up. I also just tested your print and actively changed the color while my app was running in the SE2 simulator: Everything's fine, the color isn't nil and changes properly but the error's still there in the Issue Navigator. Currently I'm only getting the "The agent crashed" error for one of the 3 VCs, it seems to be pretty random.
I just read through the whole stackoverflow link you posted and there's nothing about switching back only temporarily. There's DispatchQueue.main.async, which switches back to the main thread but doesn't give you a way to specify a function in the ViewController and completion switches back permanently because, well, it's a completion handler. Of course I could give the download class a reference to the AlertController (then use DispatchQueue.main.async) but I'm not sure passing around UI elements like that is a good solution.
if print is not called, that means the crash is not there - that's the weird bit: The app doesn't crash. When I start it in the SE2 13.5 simulator, everything's working fine, the colors are set properly, including when I switch to the dark theme and the print is written to console with the proper color (not nil). But the whole time the error is listed in the Issue Navigator and there's also the small, red circle with the white x in the bar of the open files (in the part of Xcode that can display the storyboard or code). When I click on the error in the Issue Navigator, the storyboard opens with the affected ViewController selected. When I just did that, Xcode did some loading and all of the sudden the error didn't show up for VC3 anymore but instead VC1 (yesterday it listed up to 3 VCs). When I click on the error, it doesn't jump to the affected UI item though, I have to find that myself and there's also no red circle next to the UI item or the VC (as it usually would be if there's a storyboard error). In the Attributes Inspector of that UI item you can see this: https://i.imgur.com/ZZfhd35.png - Clicking on "Debug" opens an iPhone 13 Pro simulator (didn't notice that until now) and then the app crashes on it with EXC_BAD_INSTRUCTION for that line. The weirdness doesn't stop there: If I select the iPhone 13 Pro simulator manually and start the app, everything's fine, no crash and the colors are set properly, even with force unwrapping. No idea what's going on here.