Skip to content

Instantly share code, notes, and snippets.

@damodarnamala
Created April 11, 2022 06:58
Show Gist options
  • Save damodarnamala/1f87d6425c269e278258dcf1cc424cc0 to your computer and use it in GitHub Desktop.
Save damodarnamala/1f87d6425c269e278258dcf1cc424cc0 to your computer and use it in GitHub Desktop.
Example for features
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