Last active
August 6, 2018 08:38
-
-
Save V8tr/044dc47776cfd0ae628f3fcea16d718e to your computer and use it in GitHub Desktop.
Refactoring Massive App Delegate using Command pattern. See blog post for more details: https://www.vadimbulavin.com/refactoring-massive-app-delegate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Command { | |
func execute() | |
} | |
struct InitializeThirdPartiesCommand: Command { | |
func execute() { | |
// Third parties are initialized here | |
} | |
} | |
struct InitialViewControllerCommand: Command { | |
let keyWindow: UIWindow | |
func execute() { | |
// Pick root view controller here | |
keyWindow.rootViewController = UIViewController() | |
} | |
} | |
struct InitializeAppearanceCommand: Command { | |
func execute() { | |
// Setup UIAppearance | |
} | |
} | |
struct RegisterToRemoteNotificationsCommand: Command { | |
func execute() { | |
// Register for remote notifications here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment