DEV Community

Makarov
Makarov

Posted on

How is this dirty code

I started writing code in Swift, now when the application is launched, its functionality does not work well. I surfed the Internet for possible causes and came across information about dirty code and its refactoring. Who did the refactoring for the source code? Does this help solve the issue with the functionality?
Here is the code:
`//
// proSwift.ru
//
// Swift 3

init?(brand: String) {
    if let oil = MotorOil(rawValue: brand) {
        self.oilBrand = oil
    } else {
        return nil
    }
}`
Enter fullscreen mode Exit fullscreen mode

Top comments (0)