Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Three parameters are repeated in both functions
- func login(username: String, password: String, isExpired: Bool) {
- // ...
- }
- func authenticate(username: String, password: String, isExpired: Bool) {
- // ...
- }
- // Solution: Group them as a separated type
- struct Required {
- let username: String
- let password: String
- let isExpired: Bool
- }
- func login(required: Required) {
- // ...
- }
- func authenticate(required: Required) {
- // ...
- }
Add Comment
Please, Sign In to add comment