krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.14k stars 114 forks source link

Forward `toolbarItems` from VC instance #48

Closed rnystrom closed 2 years ago

rnystrom commented 2 years ago

Started using Inject this week and am excited at the potential! I immediately noticed that toolbar items weren't working, so this was easy to patch.

While this works, I also realized that any future changes to toolbar or navigation items (which I'm doing heavily) wont reflect in the UI. I started on a KVO rabbit-hole but decided to just patch this first before going crazy. Have you thought about this problem at all? I might experiment with some solutions inhouse if you'd like help.

krzysztofzablocki commented 2 years ago

While this works, I also realized that any future changes to toolbar or navigation items (which I'm doing heavily) wont reflect in the UI

Won't reflect in what case? if you make them dynamic (based on state) not code injection related?

I don't see any simple way of Hosts observing Child VC changes on those propertise that doesn't get complicated, OTOH an option might be going the other way around since you could make a convenience extension for the VC's like activeController (or smt) that would check if parent is the HostViewController and if it is it would return it, otherwise it would return self, then in the VC itself you could make your updates like activeController.toolbarItems = []

rnystrom commented 2 years ago

Had the same thought about an extension for setting toolbar items from the children themselves, that's probably the simpler way go.