Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift ui enum

enum WeatherType {
    case sun
    case cloud
    case rain
    case wind
    case snow
}

func getHaterStatus(weather: WeatherType) -> String? {
    if weather == .sun {
        return nil
    } else {
        return "Hate"
    }
}

getHaterStatus(weather: .cloud)
Source by www.hackingwithswift.com #
 
PREVIOUS NEXT
Tagged: #swift #ui #enum
ADD COMMENT
Topic
Name
9+8 =