Post

Replies

Boosts

Views

Activity

Using @IBDesignable with Xcode 14.2
I have this issue whenever I add @IBDesignable to the class of a custom view I'm creating, and add that custom view to a UIViewController in Main.storyboard (i.e the interface builder). The custom view does not render in Main.storyboard, and I get the error "Failed to launch designables agent becaise tool was shutting down. Check the console for a more detailed description and please file a bug report at feedbackassistant.apple.com." in the attributes inspector of the custom view. I have tried all the solutions I could find on the net, and followed all the tutorials I could find for how to create a custom view. I even tried copy + paste code of custom views that others claimed was what worked for them, but the issue still remains. I'm not sure what the issue exactly is. Among the solutions I tried: Adding both required init?(coder: NSCoder) and override init(frame: CGRect), and adding calls for their super functions Adding override func awakeFromNib() and override func prepareForInterfaceBuilder(), as well as calls to their super functions Deleting any variables that load a UIColor from the assets, because some mentioned that not specifying the correct bundle caused the issue, and I wanted to test if removing the calls (to kill the root) would resolve the problem, but it didn't Adding an @IBInspectable attribute, because someone mentioned that @IBDesignable had to be accompanied by one at least Using Xib instead of generating the views from the code, and specifying the bundle to be used to get the views explicitly (instead of leaving it as the main bundle) Customizing the appearance of the view, including size and constraints, in prepareForInterfaceBuilder(), because someone mentioned that getting the views from the xib doesn't mean they're properly configured to be displayed on the storyboard Converting from Cocoapads to SPM, because it was a known issue with cocoapads that I couldn't resolve no matter what I did Deleting the project's Derived Data folder, cleaning the build folder, building the project and refreshing all views Adding $(FRAMEWORK_SEARCH_PATHS) to the Runpath Search Paths in the build target's settings For debugging, I tried the following: Debugging the view hierarchy, but I got nothing Debugging the selected view, while I was selecting the custom view in Main.storyboard, and I also got nothing Checking the Console.app for any crash reports, but I found no related crash reports Checking ~/Library/Logs/DiagnosticReports for any related crashes or otherwise logs, but I didn't find anything as well All I can conclude is that this somehow and/or for some reason not considered a crash (even if the warning I get in the issue navigator specifies that the "agent crashed") and thus not recorded in the logs. I know that this doesn't really stop my app from working and I can run it just fine, with or without the @IBDesignable annotation, but designing my custom view would take significantly longer that way, as I would have to re-launch the app every time I make even the slightest modification to the code. Can someone help me if you managed to get this working well on the latest versions of Xcode?
1
2
805
Mar ’23
Status bar going black after UIAlertController's dismiss
For the life of me, I can't figure why. I'm displaying a UIAlertController on a UIViewController embedded in a UINavigationController. The navigation bar has a dark color, so I made the navigation bar's style black so that the text would appear white. Apparently overriding preferredStatusBarStyle does not work when a UIViewController is embedded in a UINavigationController, because the latter does not pass the configuration on to its children. Because the default behavior / appearance of the navigation bar currently is that its background does not extend to cover the status bar, I set the appearnce myself in the UIViewController's viewDidLoad() method. Now, everything is working as it should. The navigation bar has a dark background and a white text, and all is well and good. Until I presented a UIAlertController with a default action and dismissed it with the button, that is. Now, for some reason, the status bar's text reverted back to being black. I don't understand what's happening. I tried setting modalPresentationCapturesStatusBarStyle to true on the "host" UIViewController, but that only made the status bar black while the alert was open, and it stayed that way when it was dismissed. I tried presenting a modal on a UIViewController not embedded in a UINavigationController, but it didn't face the issue. The status bar was white all the way through, so I conclude it has something to do with the UIViewController being embedded. I read somewhere that the issue got resolved by setting the root viewController for the UINavigationController explicitly, but no accompanying code as to how that should be done. Any ideas as to what I should do to make it stay white? And sorry for the long post. I thought I should mention all I've tried and concluded.
0
0
291
Mar ’23