alpha-wallet-ios
alpha-wallet-ios copied to clipboard
Refactor PromptViewController to replace the delegate with with 1-2 closures
After #6034
This approach shouldn't be employed for the entire codebase, but it makes the client code better for the type of work PromptViewController does. For example. when enabling/disabling testnets, the client code is like this:
if userTabToEnableTestnet
promptUserWithPromptViewController
else
proceed
enableTestnet(false)
end
//…lots of code in between
//…lots of code in between
//…lots of code in between
//…lots of code in between
//Somewhere else
func actionButtonTapped(inController controller: PromptViewController)
enableTestnet(true)
end
The 2 pair of calls for enableTestnet() are too far from each other.
Watch out for weak references