Created
December 5, 2020 23:55
-
-
Save SlappyAUS/ecf4f7ce021c7c76cf5da03da76b2aa7 to your computer and use it in GitHub Desktop.
Attributed Enums #swift #enums
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
| 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