AlphaWallet / AlphaWallet/alpha-wallet-ios
Refactor PromptViewController to replace the delegate with with 1-2 closures
- Lingua principale
- Swift
- Stelle
- 631
- Fork
- 384
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.