nicklockwood / layout

A declarative UI framework for iOS
MIT License
2.23k stars 97 forks source link

Getting a layout error bricks the app #164

Open ayrtonsoftware opened 5 years ago

ayrtonsoftware commented 5 years ago

My app allows the user to edit the layout and redisplay. But when an error happens, the whole windows is taken over and there is no way back to the code editor.

nicklockwood commented 5 years ago

@ayrtonsoftware you can disable the layout error console using LayoutConsole.isEnabled = false, or hide it programmatically using LayoutConsole.hide().

ayrtonsoftware commented 5 years ago

@nicklockwood, thanks. This will work on getting rid of the console, but how to I get the errors? I will display them in my own UI. - Thanks

I am doing this:

self.loadLayout(withContentsOfURL: viewModel.path) { (error: LayoutError?) in print(error?.description) print(error?.localizedDescription) print(error?.suggestions) }

but the error is always nil....

nicklockwood commented 5 years ago

@ayrtonsoftware the error parameter only catches errors that occur during loading. To catch other errors you will need to implement the func layoutError(_ error: LayoutError) delegate method in your Layout ViewController.