If the ui_myToggle1 is a switch widget or a checkbox, anything that can be toggled (has ‘checkable’ flag), you can get its ‘checked’/‘unchecked’ state by lv_obj_has_state( ui_myToggle1, LV_STATE_CHECKED ) (Simply checking the widget’s pointer might only tell if it was created or not, i.e. it’s a NULL/undefined pointer or a valid lv_obj_t* widget-pointer.)
You can put it directly into an if/else clause, no need for an intermediate variable. I don’t know whether you need this checking occasionally or cyclically (in main loop), but if you’d like to trigger events when the widget is toggled (event-driven behaviour) you should create an ‘event’ for it in SquareLine Studio, which creates callback-function in the exported source code.