Skip to content

Instantly share code, notes, and snippets.

@SlappyAUS
Created December 5, 2020 23:55
Show Gist options
  • Save SlappyAUS/ecf4f7ce021c7c76cf5da03da76b2aa7 to your computer and use it in GitHub Desktop.
Save SlappyAUS/ecf4f7ce021c7c76cf5da03da76b2aa7 to your computer and use it in GitHub Desktop.
Attributed Enums #swift #enums
enum SocialMediaPlatofrm {
case twitter(followers: Int)
case youtube(subscribers: Int)
case instagram
case linkedin
}
func getSponshorshipEligibility(for platofrm: SocialMediaPlatform) {
switch platform {
case .twitter(let followers) where followers > 10_000:
print("Eligible")
case .youtube(let subscribers) where subscribers > 25_000:
print("Eligible")
case .instagram, .linkedin, .twitter, .youtube:
print("Not Eligible")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment