Add protocols inside the same file as controller I have a question about something maybe not so much important, but every time when I have to decide, I feel it can write in another way.
Imagine I am developing and system about authentication and then I have to receive a pin after sending my phone number.
So I am writing some UseCase and, in this case, I have an interactor and a Worker as protocol.
Let's show the code
import Foundation

protocol SendPinWorker {
    func run(onResult: ((Result&lt;Bool, Error&gt;)-&gt;Void)?)
}

protocol SendPinUseCaseInteractor {
    func error(e: SendPINUseCaseError)
    func sent()
    func processing()
}

enum SendPINUseCaseError {
    case invalidPhone
    case couldNotSend
}

class SendPINUseCase {

    private let worker: SendPinWorker
    private let output: SendPinUseCaseInteractor
    init(worker: SendPinWorker, output: SendPinUseCaseInteractor) {
        self.worker = worker
        self.output = output
    }

    func execute(phone: String) {
        guard !phone.isEmpty else {
            self.output.error(e: .invalidPhone)
            return
        }

        self.output.processing()

        self.worker.run { [weak self] result in

            guard let self = self else {
                return
            }

            guard let sent = try? result.get(), sent else {
                self.output.error(e: .couldNotSend)
                return
            }

            self.output.sent()
        }
    }
}

Should I put these protocols and enums in another file or should I still with these structures in the same file?
Consider nesting your types:
If you have two types that start with the same prefix, it's possible that one type is better nested inside the other.
For example: SendPINUseCase raises SendPINUseCaseError's
class SendPINUseCase {
    enum Error {
        case invalidPhone
        case couldNotSend
    }
}

Now you have a type called SendPINUseCase.Error, it's scoped to the SendPINUseCase. If you want to use throwing functions instead of returning Result&lt;..., Error&gt;'s, then you would make your SendPINUseCase.Error enum conform to Swift.Error
Protocols can't be nested, but in this case you could avoid them entirely by changing your design so that, for example, execute function takes, as arguments, the callback functions involved. If you eliminate the protocols, then there's no worry about which file to put them in, and protocols are not without their problems, I would say protocols are not the right abstraction in this case.
Your SendPINUseCase is a class but doesn't encapsulate any state, so consider making it a struct.
You have execute function take a String as input, and then validate that string is a 'phone'. Instead, consider making a struct Phone that has a failable initializer, so that only valid 'Phone's can be constructed. Then execute function would take a Phone struct that you know is valid, that eliminates the invalidPhone error case entirely.