Created
April 11, 2022 06:58
-
-
Save damodarnamala/1f87d6425c269e278258dcf1cc424cc0 to your computer and use it in GitHub Desktop.
Example for features
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 Feature { | |
static func load() | |
} | |
class LoginFeature: Feature { | |
static func load() { | |
print("loging in with") | |
} | |
} | |
class HomeFeature: Feature { | |
static func load() { | |
print("loading 'HomeFeature' ") | |
} | |
} | |
class Features { | |
var all: [Feature.Type] { | |
return [LoginFeature.self, HomeFeature.self] | |
} | |
} | |
/// Ussage | |
let features = Features() | |
features.all.forEach { feature in | |
feature.load() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment