4 ms·
I've done a ton of apps for iOS and I'm really sure I'm never going to do another implementation of vanilla segue unwind UIViewController routing ever again, un
by dep_b 9y ago
I've done a ton of apps for iOS and I'm really sure I'm never going to do another implementation of vanilla segue unwind UIViewController routing ever again, unless it's something totally stupid like an on boarding sequence.
For more complex applications that also need to open from push notifications or respond to events and have several ways to end up in some sort of screen (like going to a chat view controller discussing a certain document from a push notification) it's just not doable to do all these tight couplings between screens.
I create a router that has an enum per screen which can accept another parameter if there can be a certain mode or certain data is required. The router figures everything out and the enums force you to provide the right associated data. Just call something like this from any place in the code you want to segue and it's done:
Router.segue(to: .profile(of: .followedUser(selectedUser)))