Skip to content

Instantly share code, notes, and snippets.

@iamazhar
Last active April 22, 2019 06:23
Show Gist options
  • Select an option

  • Save iamazhar/bab70429d0dfc78236438b82e52ffe17 to your computer and use it in GitHub Desktop.

Select an option

Save iamazhar/bab70429d0dfc78236438b82e52ffe17 to your computer and use it in GitHub Desktop.
// MARK: - Bird View Model
public class BirdViewModel {
//1
private let bird: Bird
public init(bird: Bird) {
self.bird = bird
}
//2
public var name: String {
return bird.name
}
public var image: UIImage {
return bird.image
}
//3
public var purchaseFeeText: String {
switch bird.rarity {
case .common:
return "$40"
case .uncommon:
return "$65"
case .rare:
return "$100"
case .veryRare:
return "$300"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment