I'm learning about the Layered Architecture Pattern for Software Development but I'm confused on how objects are sent 'up' the layers. In general, I know that there are about 4 main layers: ui layer, use case layer, domain layer, data access layer.
So now, let's say I am developing a use case to display all todo items from a todo list on the screen. My domain would have two classes: TodoList and TodoItem. The TodoList class will have a list of TodoItems and the TodoItem class will have a description attribute. Both these classes are created in the domain layer and 'only' the use case layer has access to the domain layer. So, the use case layer will call on the domain layer to get the list of todo items. At this point, will the method getTodoList() return the 'TodoList' object defined in the domain layer back to the UI layer?
If this is correct, then the UI layer would have access to the domain layer object which in my opinion breaks the layered architecture pattern because now the developer can further call directly to the domain layer of that object.
I'm confused at this part and would greatly appreciate clarity on how objects are passed down and up the layers of the layered architecture pattern.