DEV Community

Makarov
Makarov

Posted on

1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay